Design Time Data from Class with Enums RRS feed

  • Question

  • I've used blend to create a design time data xml file from a class. My class however has an enum in it and the design time data xml just has the text value of the enum - this doesn't seem to actually work. My enum to text converter works fine with actual class datacontext at run time - but not in the designer. Other string properties of the class have no problem binding to the designer.

    I have searched and searched without finding out if this is supported or not.

    If my class has an public enum defined - should that work in design time data binding?

    public enum MyEnum { enum1 = 0, enum2, enum3 }

    class MyClass { public MyEnum EnumProperty; }

    xml generated by blend has EnumProperty="enum2"

    but that gets passed to my converter as a string object - not an enum.

    Am I missing something here?

    Sunday, April 12, 2015 1:53 AM

All replies

  • Haven't figured out how to use enums in the design data .xml file - but came up with one solution - change the viewmodel to use an int value instead of the actual enum. Failing that I found the following link - and realized that I could give up on the .xml file and just create a design instance of my view model class to use.

    However, I am still curious if I missed some way to actually use enum values in design data.

    • Proposed as answer by dns jinung Monday, April 20, 2015 9:14 AM
    Sunday, April 12, 2015 3:42 AM