From the course: Microsoft XAML: 3 Type Converters and Resources

Unlock the full course today

Join today to access over 22,500 courses taught by industry experts or purchase this course individually.

Add parameters to a custom markup extension

Add parameters to a custom markup extension

From the course: Microsoft XAML: 3 Type Converters and Resources

Start my 1-month free trial

Add parameters to a custom markup extension

- [Lecturer] I'll add some parameters to this mark-up extension by creating another constructor. First thing I need to do is create another field up here. Private, this is going to be a Boolean. This one will be called show dice total. I'll set the default value for this to true. Then I'll modify my code in the provide value section. So I have this list here that I've added, and this will be for storing the individual dice values. So inside my for loop when I generate my random number I'll go to my dice list, and I'll add the role value there. Then down here in this if statement, I'll check this show dice total. If that's true, then I'll return the total, otherwise I'll return a common delimited list of the items that are in this dice list. I'll compile everything, make sure it works. Got no build errors. Now the last thing I need to do is add the constructor, so that I can pass those multiple parameters. So I'll copy this constructor. Now here I'll set my field, show dice total is…

Contents