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 !
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 .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.