Hi,
I am quite new to Avalon and I have a question about DataTriggers. I have a ListBox and I want to edit the style of the marked item in the list. I have figured out that I probably need DataTriggers, but I don't get it to work. (I'm using the February CTP)
I have a ListBox containing of TextBlocks, in the Style for those TextBlocks I have the following code:
<Style.Triggers>
<DataTrigger>
<DataTrigger.Binding>
<Binding Path="IsSelected" RelativeSource='{RelativeSource TemplatedParent}'/>
</DataTrigger.Binding>
<DataTrigger.Value>
<System:Boolean>True</System:Boolean>
</DataTrigger.Value>
<Setter Property='Foreground' Value='sc#1, 0, 1, 0'/>
</DataTrigger>
</Style.Triggers>
Nothing happens however. I am unsure about how the RelativeSource-attribute works, and even about if I should use a data trigger or an event trigger. Read in a WPF book that "you can’t set a property with an event trigger or raise an event with a property or data trigger". Does this mean that it's not possible to edit the style of the ListBoxItem when it is clicked Or have I misunderstood something
All I want to do is to be able to change the blue background when a list item is clicked to something else. Basic thing to do somehow, but I don't manage to solve it. Can anybody help
Thanks,
Tomas

DataTrigger to mark selected item in ListBox?
Ravi Verma_Ambala