I have a simple .Net enum. I also have a view model object that has a "CurrentValue" property like my enumeration. This property can be data bound (the object implements INotifyPropertyChanged). Now I would like to show one user interface element for each enumeration value in a specific order and highlight the selection "CurrentValue" (in bold). I would like the declaration to be something like:
<StackPanel Orientation="Vertical">
<ContentControl Content="{x:Static MyEnum.Value1}" />
<ContentControl Content="{x:Static MyEnum.Value2}" Margin="10" />
<ContentControl Content="{x:Static MyEnum.Value3}" />
</StackPanel>
I would like to declare each value separately to indicate the order, but also because I want some elements to have certain margin values. In addition, I will want to display specific icons for each value later.
Now I have lost how I can declare that I want the control associated with CurrentValue to be bold. I tried using the generic DataTrigger template inside the template to check the contents on CurrentValue, but it seems the trigger value cannot be a binding.
I also thought that you were going to disable the ListBox, but then I cannot have specific fields for certain elements. Or can I?
FranΓ§ois Paradis
source
share