0

I'm changing the look of all ComboBoxes in my application by adding this Style to App.xaml:

    <Style TargetType="ComboBox">
        <Setter Property="Foreground" Value="White"/>
        <Setter Property="Background" Value="#303030"/>
        <Setter Property="BorderBrush" Value="#000000"/>
    </Style>

There are two colors that I haven't been able to set:

1) the Background color whenIsEnabled=false

2) the highlight Background color when the mouse is over the ComboBox.

How can I change these two colors?

[edit: it looks like the highlight color is not the same as the mouse over color, because when I move my mouse over the ComboBox it will briefly turn the color I defined as the mouse over color, and then turn into some other color (light blue)]

Dave Clemmer
  • 3,741
  • 12
  • 49
  • 72
Warpin
  • 6,971
  • 12
  • 51
  • 77

1 Answers1

2

You want to check Style Triggers . Also need to override the ItemContainerStyle to get rid of the default light blue selection color

<Style.Triggers>
  <Trigger Property="IsMouseOver" Value="true">
    <Setter Property="Background" Value="SomeColor" />
  </Trigger>
  <Trigger Property="IsEnabled" Value="false">
    <Setter Property="Background" Value="SomeOtherColor" />
  </Trigger>
</Style.Triggers>
Jobi Joy
  • 49,102
  • 20
  • 108
  • 119
  • The highlight doesn't quite work. I set color Red for IsMouseOver and it does turn red for about a quarter of a second, and then the highlight color turns to light blue (which is used to turn to directly). – Warpin Mar 05 '10 at 08:11
  • 2
    I hope you put this style in to the ItemContainerStyle (Whcih is style for ComboBoxItem) – Jobi Joy Mar 05 '10 at 19:15