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
From the course: Microsoft XAML: 3 Type Converters and Resources
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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
Explore the concepts of type converters5m 26s
-
Use some type converters6m 30s
-
Create a custom type converter8m 24s
-
A markup extension and how it compares to a type converter3m 11s
-
Use some common markup extensions5m 47s
-
Create a custom markup extension3m 29s
-
Add parameters to a custom markup extension4m 34s
-
-
-