私はいくつかの調査を行い、それぞれに別の背景色を設定する方法を見つけましたListBoxItem
が、リストボックスが空であってもその背景を継続したい.
<Style x:Key="ListBoxStyle" TargetType="ListBox">
<Setter Property="Width" Value="288"></Setter>
<Setter Property="BorderBrush" Value="#D2D2D2"></Setter>
<Setter Property="BorderThickness" Value="1"></Setter>
<Setter Property="Margin" Value="1,0,1,0"></Setter>
<Setter Property="AlternationCount" Value="2"></Setter>
<Setter Property="HorizontalContentAlignment" Value="Stretch"></Setter>
</Style>
<Style x:Key="ListBoxItemStyle" TargetType="ListBoxItem">
<Setter Property="Height" Value="27"></Setter>
<Setter Property="FontWeight" Value="Medium"/>
<Setter Property="FontSize" Value="12"/>
<Setter Property="Foreground" Value="#333333"/>
<Style.Triggers>
<Trigger Property="ItemsControl.AlternationIndex" Value="0">
<Setter Property="Background" Value="White"></Setter>
</Trigger>
<Trigger Property="ItemsControl.AlternationIndex" Value="1">
<Setter Property="Background" Value="#19000000"></Setter>
</Trigger>
</Style.Triggers>
</Style>
ListBox の高さ全体に別の背景を設定することは可能ですか?