Ribbon Group Scroll Button Width

Ribbon for WPF Forum

Posted 2 years ago by Adam Reiger
Version: 17.1.0651
Avatar

Hi,

Is there a way to change the width (11px) of the two scroll buttons in the ribbon? They show when the ribbon has nothing else to collapse or all groups in a tab have IsCollapsible="False".

Thanks.

[Modified 2 years ago]

Comments (3)

Answer - Posted 2 years ago by Adam Reiger
Avatar

Nevermind, I figured it out. Getting the default style of the GroupPresenter then adding a MinWidth to each button did it.

Answer - Posted 2 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Adam,

Right now the default style for the ScrollLeftButton is:

<Style x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type ribbon:Ribbon},ResourceId=ScrollLeftButton}" TargetType="{x:Type Button}">
	<Setter Property="HorizontalAlignment" Value="Left" />
	<Setter Property="Visibility" Value="Collapsed" />
	<Setter Property="Template">
		<Setter.Value>
			<ControlTemplate TargetType="{x:Type Button}">
				<Border x:Name="RibbonGroupScrollButtonBorder" Margin="{TemplateBinding Margin}" 
					Background="{DynamicResource {x:Static themes:AssetResourceKeys.RibbonTabControlBackgroundNormalBrushKey}}"
					BorderBrush="{DynamicResource {x:Static themes:AssetResourceKeys.RibbonTabControlBorderNormalBrushKey}}" 
					BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="3,0,0,3" SnapsToDevicePixels="True">
					<Path Margin="3" VerticalAlignment="Center" HorizontalAlignment="Center"
							Fill="{DynamicResource {x:Static themes:AssetResourceKeys.MenuItemPopupGlyphBackgroundNormalBrushKey}}" 
							Data="{DynamicResource {ComponentResourceKey TypeInTargetAssembly={x:Type ribbon:Ribbon},ResourceId=MenuScrollViewerLeftArrow}}"/>
				</Border>
					
				<ControlTemplate.Triggers>
					<Trigger Property="IsMouseOver" Value="True">
						<Setter TargetName="RibbonGroupScrollButtonBorder" Property="Background" Value="{DynamicResource {x:Static themes:AssetResourceKeys.ToolBarButtonLargeBackgroundHoverBrushKey}}"/>
					</Trigger>
				</ControlTemplate.Triggers>
			</ControlTemplate>
		</Setter.Value>
	</Setter>
</Style>

You could probably override that Template in a cloned implicit Style in your App.Resources.  The matching ScrollRightButton Style is the same other than using a MenuScrollViewerRightArrow resource in the Path.

Or you could do it how you did it as well.


Actipro Software Support

Posted 2 years ago by Adam Reiger
Avatar

That works to, thanks.

The latest build of this product (v2019.1 build 0681) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.