<ComboBox Grid.Column="1" Grid.Row="1" ItemsSource="{Binding Locations}" SelectedItem="{Binding SelectedLocation}" Margin="5" MinWidth="125">
<ComboBox.ItemContainerStyle>
<Style TargetType="{x:Type ComboBoxItem}">
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter Property="Background" Value="Red" />
<Setter Property="BorderBrush" Value="Red" />
<Setter Property="BorderThickness" Value="2" />
</Trigger>
</Style.Triggers>
</Style>
</ComboBox.ItemContainerStyle>
</ComboBox>
現在邊框被應用,但背景顏色仍然是標準的Windows選擇顏色,我如何覆蓋它?組合框鼠標移過顏色
是什麼讓這個解決方案更好?另一個有缺點嗎? – Peter
爲組合框覆蓋模板而不是爲組合框覆蓋SystemColors.HighlightBrushKey,對我個人而言不是一個好的解決方案。 –
它可能有副作用,也許稍後如果項目樣式中的某個控件使用畫筆 – punker76