In WPF how to define a Data template in case of enum?

后端 未结 3 1761
感情败类
感情败类 2021-01-13 20:38

I have a Enum defined as Type

public Enum **Type**
{
   OneType,
   TwoType,
   ThreeType
};

Now I bind Type to a drop dow

3条回答
  •  囚心锁ツ
    2021-01-13 21:10

    One way to do it would be to create a DataTemplateSelector, and assign it to the ItemTemplateSelector property of the menu. In the code of the DataTemplateSelector, you just need to return a DataTemplate based on the enum value

提交回复
热议问题