We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to set ribbonbar at the right side of WPF Ribbon control?

Platform: WPF |
Control: Ribbon |
Published Date: November 27, 2015 |
Last Revised Date: April 13, 2021

You can set the RibbonBar at the right side in WPF Ribbon control. Before that, you need to create a dummy RibbonBar and set the Visibility property to Hidden and then calculate the width between the RibbonBar’s and set to it.

The same has been explained in the following code example.

XAML

<Syncfusion:Ribbon  SizeChanged="ribbon_SizeChanged" Name="ribbon"    VerticalAlignment="Top"  >            
        <Syncfusion:RibbonTab  Caption="Folder" IsChecked="True" >
            <Syncfusion:RibbonBar x:Name="ribbonBar1" Width="200" Header="Clean Up">
            <Syncfusion:RibbonButton SizeForm="Large" SmallIcon="/Resources/Delete-All.png" Label="Delete All"/>
            <Syncfusion:RibbonButton SizeForm="Large"  SmallIcon="/Resources/Recover-Deleted Items.png" Label="Recover Deleted Items"/>
        </Syncfusion:RibbonBar >
            <Syncfusion:RibbonBar x:Name="collapseRibbonBar"  Visibility="Hidden"/>
            <Syncfusion:RibbonBar HorizontalAlignment="Right" Width="200" Grid.Column="2"  x:Name="ribbonBar2"   Header="Properties"  >
            <Syncfusion:RibbonButton SizeForm="Large" SmallIcon="/Resources/Show-in-Favorites.png" Label="Show in Favourites"/>
                <Syncfusion:RibbonButton SizeForm="Large" SmallIcon="/Resources/Properties.png" Label="Folder Properties"/>
                <Syncfusion:RibbonButton SizeForm="Large" SmallIcon="/Resources/Archive.png" Label="Auto Archieve Settings"/>
        </Syncfusion:RibbonBar>
        </Syncfusion:RibbonTab>
        <Syncfusion:RibbonTab   Caption="Send/Receive" IsChecked="False" />
</Syncfusion:Ribbon>

C#

private void ribbon_SizeChanged(object sender, SizeChangedEventArgs e)
{
    RibbonTabItemsControl ribbontabitem = VisualUtils.FindDescendant(this, typeof(RibbonTabItemsControl)) as RibbonTabItemsControl;    
    double width=0;
    foreach (Button item in VisualUtils.EnumChildrenOfType(ribbontabitem, typeof(Button)))
    {
        width = item.ActualWidth;                   
    }
    try
    {
        collapseRibbonBar.Width = ribbontabitem.ActualWidth - ((ribbonBar1.Width + ribbonBar2.Width)) - width+7;              
    }
    catch(Exception )
    {                   
    }         
}    

 

The following screenshot displays the RibbonBar at the Right Side.

Ribbonbar shows in right side in WPF Ribbon control

View sample in GitHub.

2X faster development

The ultimate WPF UI toolkit to boost your development speed.
ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon