I am trying to create a custom style for a WPF ComboBox but whenever I do, the drop down does not open, I want to use the following XAML Code created from my buttons style but port it to work with a ComboBox Control, how would I go about doing this so that the dropdown does show and will give me the ability to change the mouseover colours.
<ControlTemplate TargetType="Button">
<Border Name="border"
BorderThickness="{TemplateBinding BorderThickness}"
Padding="{TemplateBinding Padding}"
BorderBrush="{TemplateBinding BorderBrush}"
CornerRadius="1"
Background="{TemplateBinding Background}">
<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
</Border>
<ControlTemplate.Triggers>
<!--TODO: Set the right colors-->
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="border" Property="BorderBrush" Value="#FFC6C6C6" />
<Setter Property="Foreground" Value="#FF333333" />
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter Property="Foreground" Value="#FF666666" />
</Trigger>
<Trigger Property="IsEnabled" Value="false">
<Setter Property="Foreground" Value="#FFCCCCCC"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
ComboBoxes are rather complex, if you change one aspect of the ControlTemplate like those triggers you would need to supply all of the other functionality as well, your best bet might be copying the default template and adjusting it. The default templates can be found on MSDN (see
Default WPF Themeslink).