How to: Use Triggers to Style a ToolBar

This example describes how to use a Trigger to style a ToolBar. The sample shows how to create a Style that changes the appearance of a ToolBar in response to events raised on the bar. When you move the mouse over the ToolBar its appearance changes.

Example

<Style x:Key="Triggers" TargetType="{x:Type ToolBar}">
    <Style.Triggers>
    <Trigger Property="Button.IsMouseOver" Value="true">
        <Setter Property = "Background" Value="Red"/>
        <Setter Property = "BorderBrush" Value="Green"/>
    </Trigger>
    </Style.Triggers>
</Style>

For the complete sample see ToolBar Styles Sample.

See Also

Tasks

How to: Create a ToolBar

Other Resources

WPF Controls Gallery Sample