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

后端 未结 3 1787
感情败类
感情败类 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

    Not sure whether this is an applicable solution to your particular situation, but it is relevant to the question of DataTemplate for enum. It is possible to create one DataTemplate for the enum type and use DataTriggers to tweak the controls in that template for individual enum value:

    Enum:

    enum MyEnumType 
    {
        ValueOne,
        ValueTwo,
    }
    

    Template:

    
        
        
            
                
            
            
                
            
        
    
    

提交回复
热议问题