I have a Enum defined as Type
public Enum **Type**
{
OneType,
TwoType,
ThreeType
};
Now I bind Type to a drop down Ribbon Control Drop Down Menu in a Ribbon Control that displays each menu with a MenuName with corresponding Image.
( I am using Syncfusion Ribbon Control ).
I want that each enum type like ( OneType ) has data template defined that has Name of the menu and corrospending image.
How can I define the data template of enum ?
Please suggest me the solution, if this is possible !!
Please also tell me if its not possible or I am thinking in the wrong direction !!
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:
<DataTemplate DataType="{x:Type MyEnumType}">
<TextBlock x:Name="valueText"/>
<DataTemplate.Triggers>
<DataTrigger Binding="{Binding}" Value="{x:Static MyEnumType.ValueOne}">
<Setter TargetName="valueText" Property="Text" Value="First Value" />
</DataTrigger>
<DataTrigger Binding="{Binding}" Value="{x:Static MyEnumType.ValueTwo}">
<Setter TargetName="valueText" Property="Text" Value="Second Value" />
</DataTrigger>
</DataTemplate.Triggers>
</DataTemplate>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With