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.

Create a custom type converter

Create a custom type converter

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

Start my 1-month free trial

Create a custom type converter

- [Instructor] I'm ready to create a custom type converter to solve this problem. I have this rating control, and if you remember the rating control has a number of properties. They're listed here, and the property that we're concerned about is this StarBorder property. It's of a custom type, I created a type called Borderline, and when I attempt to set the value in my XAML over here, copy this and paste it in here, I get a blue squiggle. When I hover over that it says the TypeConverter for Borderline does not support converting from a string. The actual problem is the Borderline class doesn't even have a TypeConverter, so let's fix that. I'll go over to my rating control, go to it's C# code, and what I did is I created a class in here called Borderline and I also created a class in here called BorderlineConverter, and there's also a class of course my rating control is in here, now normally I would put these classes in separate files, but for this demonstration for simplicity…

Contents