AlternationIndex
and
IsSelected
are both properties of a
ListViewItem
, so a standard
Style.Trigger
will not work.
You need to use a
MultiTrigger Class (System.Windows) | Microsoft Learn[
^]. Examples are provided with that link, however here is how I would use it (untested):
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsSelected" Value="True"/>
<Condition Property="ItemsControl.AlternationIndex" Value="0"/>
</MultiTrigger.Conditions>
<Setter Property="Background" Value="LightGreen"/>
</MultiTrigger>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsSelected" Value="True"/>
<Condition Property="ItemsControl.AlternationIndex"
Value="1"/>
</MultiTrigger.Conditions>
<Setter Property="Background" Value="LightBlue"/>
</MultiTrigger>
Enjoy!