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

Unlock the full course today

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

A markup extension and how it compares to a type converter

A markup extension and how it compares to a type converter

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

Start my 1-month free trial

A markup extension and how it compares to a type converter

- [Instructor] In this section of the chapter, I'll examine the concept of markup extensions. They are a way of extending the XML markup that's inside your XAML file, and in particular, they allow me to run code when I do a property assignment. So instead of using this hard-coded value here of purple, I can invoke a markup extension. That markup extension will go run some code and determine what the value is for color. Now some of you are probably thinking that sounds a lot like a type converter, and it is. Remember that type converters, in this case here, takes this string, which contains a number, runs it through a type converter, inside the type converter is a method, it takes that string and turns it into the correct value that I need for this width property. Same thing here with this string. I run this through a type converter, that turns it into a solid color brush, so I can assign it to the brush property here, and here's a common delimited value that turns this into a…

Contents