Task: it is necessary to use for each even and odd line its own color scheme (maximum 2 colors for any number of records). Thank!
1 answer
Very simple. Use AlternationIndex and triggers:
<ListView ItemsSource="..." AlternationCount="2"> <ListView.ItemContainerStyle> <Style TargetType="ListViewItem"> <Style.Triggers> <Trigger Property="ItemsControl.AlternationIndex" Value="0"> <Setter Property="Background" Value="DarkGray" /> </Trigger> <Trigger Property="ItemsControl.AlternationIndex" Value="1"> <Setter Property="Background" Value="LightGray" /> </Trigger> </Style.Triggers> </Style> </ListView.ItemContainerStyle> </ListView> It turns out:
|
