Share via


How to: Use Triggers to Style a ComboBoxItem

This example shows how to use Trigger elements to style a ComboBoxItem.

This example creates a Style that changes the appearance of a ComboBoxItem in response to an event that is raised on the item. When you move the mouse over the ComboBoxItem the appearance of the control changes.

Example

 <Style x:Key="Triggers" TargetType="{x:Type ComboBoxItem}">
 <Style.Triggers>
 <Trigger Property="ComboBoxItem.IsMouseOver" Value="true">
     <Setter Property = "Foreground" Value="Red"/>
     <Setter Property = "FontSize" Value="20"/>
     <Setter Property = "FontFamily" Value="Arial Bold"/>
 </Trigger>
 </Style.Triggers>
</Style> 

For the complete sample, see Combo Box Styles Sample

See Also

Tasks

How to: Create a ComboBox

Concepts

ComboBox Overview
Styling and Templating