开发者

How to generate predefined values for xaml property with typeconverter

开发者 https://www.devze.com 2023-02-26 03:34 出处:网络
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.

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消