I would like to change the appearance of the ToggleButtonTool in the xamRibbonMenu.
Currently, when the ToggleButton is checked a border is visible and the background changes OnHover-Action (see attached image).
I tried to change in the RibbonButtonToolTemplate (which is defined as a template for the ToggleButtonTool) the BorderBrush, but it seems that the Border and HoverAction is defined somewhere else?
How can I change the Border and Hover-Action of the RibbonButtonChrome in the above mentioned template:
<ControlTemplate x:Key="RibbonButtonToolTemplate" TargetType="{x:Type ButtonBase}"> <igRibbon:RibbonButtonChrome x:Name="chrome" IsPressed="{TemplateBinding IsPressed}" IsChecked="{TemplateBinding ToggleButton.IsChecked}" SnapsToDevicePixels="True" UseRoundedCorners="False">
...........
<!-- ToggleButtonTool Style --> <Style TargetType="{x:Type igRibbon:ToggleButtonTool}"> <Setter Property="ToolTipService.ShowDuration" Value="20000" /> <Setter Property="Foreground" Value="{DynamicResource {x:Static igRibbon:RibbonBrushKeys.ToolEnabledForegroundTextFillKey}}" /> <Setter Property="Template" Value="{StaticResource RibbonButtonToolTemplate}" /> </Style>
Thanks in advance!
Best regards
Michael Steinberger
Hello Michael,
Thank you for your post. I have been looking into it and I created a sample project for you with the functionality you want. Basically copied the default Style of the ToggleButtonTool and the RibbonButtonToolTemplate. In the ControlTemplate there is a Trigger for the IsMouseOver Property where I set the Background and BortherThikness of a Border I added in the RibbonButtonChrome. Please let me know if you have further questions on this matter.
Looking forward for your reply.
Thank you very much for the fast support! Your solution helped me a lot.
Best regard,
Michael