How to generate predefined values for xaml property with typeconverter
If I have a control and I start typing a foreground property for it, it offers me a list of Colors, seemingly from the Colors
class.
edit: I think it's actually the KnownColor enum, which is internal.
How is this achieved?
I have an attached property which is of type MyClass
. I have a static class with some pre-cooked instances of MyClass
. I want to achieve the same behavior described above.
I know I ca开发者_Python百科n use a type converter and convert from the string to an instance, but this seems a little more advanced
You will need to use a Type converter. The Xaml parser has built-in special handling of known types such as Brush
and Color
.
精彩评论