Hi all!
I ran following problem.
I need to build customized listbox which works just fine when it comes to binding property names and values etc. The problem is kinda cosmetic but needed. My dataclass
provides enumclass which has 8 diffirent values, each value needs to be presented with different image in listbox item. I have already included corresponding images
into my project /images folder, so task is to bind enum value to right picture. I build my listbox by using datatemplates.
I tried Datatemplate.triggers to do the task and managed to change foreground so
I thought this can do the job, just modify path of presented image, but how to do that!?
.
.
<listbox.itemtemplate>>
<DataTemplate>
<DataTemplate.Triggers>
<DataTrigger Binding="{Binding Path=MyEnumProperty}" Value="SpecifigEnum">
<Setter Property="ListBoxItem.Foreground" Value="Red"></Setter>
</DataTrigger>
</DataTemplate.Triggers>
</DataTemplate>
</ListBox.ItemTemplate>
.
.
I like to know how to solve this problem or is my path even right one? The task would be easier if my dataclass provides imagepath within, but I cannot change that so
decicion of image must make on client side.
I hope you got the idea. Like to hear your thougts! :)
Cheers!