I have a ListBox. Now I want to write a DataTemplate in such way, that the first item will have red background and white background for other items. I guess I need to write a DataTrigger, but I have no idea how do determine that DataTemplate is applying to the first item.
R – How to determine index of current ListBox item from DataTemplate
datatriggerlistboxlistboxitemwpf
Best Answer
items controls have an alternation count that you use to style against
have a look here :
enjoy!