user3753452
user3753452

Reputation: 139

WPF 4 Ribbon Window Bar Region not highlighting

In Microsoft Word, when you placed the mouse over the ribbon bar, the square region will be highlighted.

However, the highlighting is not showing up in my ribbon bar. I am new to WPF, please can someone point to me where to look for in the xaml code

Thank you !

Upvotes: 1

Views: 68

Answers (1)

Yegor Korotetskiy
Yegor Korotetskiy

Reputation: 401

I do like this. Highlighting with slight animation in XAML.

In <Window.Resources> define Style:

<Style x:Key="RectStyle" TargetType="{x:Type Rectangle}"> <Setter Property="Fill" Value="Transparent"/> <Style.Triggers> <Trigger Property="IsMouseOver" Value="True"> <Trigger.EnterActions> <BeginStoryboard> <Storyboard> <ColorAnimation Storyboard.TargetProperty="Fill.Color" To="#FF008CFF" Duration="0:0:0.1" /> </Storyboard> </BeginStoryboard> </Trigger.EnterActions> <Trigger.ExitActions> <BeginStoryboard> <Storyboard> <ColorAnimation Storyboard.TargetProperty="Fill.Color" To="Transparent" Duration="0:0:0.1" /> </Storyboard> </BeginStoryboard> </Trigger.ExitActions> </Trigger> </Style.Triggers> </Style>

Then in definition of some Rectangle(button or what you want) you must mention your Style:

<Rectangle x:Name="rect_abortTrans" Style="{StaticResource RectStyle}" ... >

That's it. The square region will be highlighted on MouseOver. Also, you can look here.

Upvotes: 1

Related Questions