我定义了以下正在应用的样式(当文本变为红色时),但我似乎无法让 Background 属性工作。谁能告诉我这有什么问题?
<Style x:Key="CompanyComboItemContainerStyle" TargetType="ComboBoxItem">
<Setter Property="SnapsToDevicePixels" Value="true"/>
<Setter Property="OverridesDefaultStyle" Value="true"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ComboBoxItem">
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Foreground" Value="Red" />
<Setter Property="Background" Value="Black" />
</Trigger>
</ControlTemplate.Triggers>
<StackPanel>
<TextBlock Text="{Binding CompanyName}" Grid.Column="0" />
<TextBlock Text="{Binding EIC, StringFormat=' ({0})'}" Grid.Column="1" FontFamily="Courier New" FontWeight="Bold" FontSize="12" />
</StackPanel>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>