Custom Type Converters
You cannot create your own type converters, unless you’re working in the context of WPF/Silverlight on the desktop. WPF exposes type converters as classes deriving from TypeConverter (BrushConverter, ColorConverter, and so on). To write your own, you create your own TypeConverter subclass. However, your type converter can only be used on properties marked with a TypeConverterAttribute custom attribute that points to your TypeConverter subclass. Or, if the source type you’re converting is one you created, you can mark that type with TypeConverterAttribute so it automatically applies to all properties of that type. The WPF XAML parser looks in both places to find the converter that it needs to invoke.
For example, the BrushConverter ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access