Is there a good way to force one single RibbonGroup within a RibbonTab to always stay docked to the right ?
I've tried to fill up the space between the last "Productive" RibonGroup and the special RibbonGroup with an empty "spacer" Group.
But keebing its width always accurate does not seem to be to easey:
<igRibbon:XamRibbonWindow xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:igRibbon="http://infragistics.com/Ribbon" x:Class="WpfApplication5.MainWindow" Title="MainWindow" Height="350" Width="525" x:Name="window"> <igRibbon:RibbonWindowContentHost x:Name="paint"> <igRibbon:RibbonWindowContentHost.StatusBar> <StatusBar Background ="#D5DBE0" MinHeight="21" MaxHeight="24" VerticalAlignment="Center" VerticalContentAlignment="Center" HorizontalAlignment="Stretch" HorizontalContentAlignment="Stretch"/> </igRibbon:RibbonWindowContentHost.StatusBar> <igRibbon:RibbonWindowContentHost.Ribbon> <igRibbon:XamRibbon x:Name= "myRibbon" IsMinimized="False" Theme="Office2013"> <igRibbon:XamRibbon.TabItemAreaToolbar> <igRibbon:TabItemAreaToolbar TabItemAreaMinWidth="150"> <igRibbon:ButtonTool Caption="About"></igRibbon:ButtonTool> </igRibbon:TabItemAreaToolbar> </igRibbon:XamRibbon.TabItemAreaToolbar> <igRibbon:RibbonTabItem Header="View" > <igRibbon:RibbonGroup x:Name="navi" Caption="NAVIGATION" Margin="7,0,0,0"> <igRibbon:RadioButtonTool Id="Home" x:Name="HomeButton" Caption="HOME" igRibbon:RibbonGroup.MaximumSize="ImageAndTextLarge"/> <igRibbon:RadioButtonTool Caption="BASIC" igRibbon:RibbonGroup.MaximumSize="ImageAndTextLarge"/> <igRibbon:RadioButtonTool Caption="TRANSFER" igRibbon:RibbonGroup.MaximumSize="ImageAndTextLarge"/> </igRibbon:RibbonGroup> <igRibbon:RibbonGroup x:Name="spacer" Width="305"/> <igRibbon:RibbonGroup Caption="RIGHT" Margin="7,0,0,0"/> </igRibbon:RibbonTabItem> <igRibbon:RibbonTabItem Header="Next"> <igRibbon:RibbonGroup x:Name="nexter" Caption="FirstGroup" Margin="7,0,0,0"> </igRibbon:RibbonGroup> <igRibbon:RibbonGroup x:Name="second" Caption="SecondGroup" Margin="7,0,0,0"> </igRibbon:RibbonGroup> </igRibbon:RibbonTabItem>
</igRibbon:XamRibbon> </igRibbon:RibbonWindowContentHost.Ribbon> </igRibbon:RibbonWindowContentHost></igRibbon:XamRibbonWindow>
Hello,
By default, I am not aware of a way to right-align a RibbonGroup inside of a RibbonTabItem. This is because the panel that the RibbonGroups sit inside of acts much like a StackPanel. After some research, I have found a way to right align the RibbonGroups inside of a RibbonTabItem though.
This solution involves going into the default styles for the XamRibbon, and finding an implicit data template that has a data type of RibbonGroupCollection. This is where that StackPanel-like panel gets set. Implement this data template into your project. A common directory to find the default style that contains this DataTemplate is: C:\Program Files (x86)\Infragistics\2014.2\WPF\DefaultStyles\Ribbon\RibbonGeneric.xaml.
Inside of this data template, there is an ItemsControl that is not named. I would recommend to first give it a name, then move to the end of this data template and add a DataTrigger to the DataTemplate.Triggers collection of this data template. This data trigger's binding will use a relative source binding to target the SelectedItem property of the XamTabControl that holds the RibbonTabItems. The setter for this data trigger should target that ItemsControl that you named earlier, and target the ItemsPanel property of it. Set this property to a new ItemsPanelTemplate with only a Grid in it.
The reason for the above trigger is because unless you want to apply the right-aligned RibbonGroup to each and every one of your RibbonTabItems, you will not want to change the default style. The reason for this is because this will allow and require you to set the position of each of the RibbonGroups in that RibbonTabItem, since the element that the groups now sit in is not a Panel, but a Grid.
One thing to note is that you will need to also set an ItemsPanel on the Groups in the tabs that have this trigger applied to it. To get the default layout of the items, I would recommend simply using an ItemsPanelTemplate with a StackPanel with Orientation="Horizontal" in it.
I have attached a sample application demonstrating the above, which uses the XAML you had originally provided.
Please let me know if you have any other questions or concerns on this matter.
Sincerely,AndrewAssociate DeveloperInfragistics Inc.www.infragistics.com/support
Hello Andrew,
I have a requirement to place one ribbon group to always dock it on the right side inside of ribbon tab item and other ribbon groups present inside this ribbon tab item should have stack panel orientation. I have tried with the above solution which you have provided but ribbon groups are getting overlapped. So in short, if there are 5 ribbon groups inside ribbon tab item then one ribbon group should always be docked at the right side and remaining ribbon groups should have stack panel orientation which is by default.
Can you please help me with some solution. Your response is very much appreciated. Thanks for your support.
Thank you for the good sample application.I did run it and the RibbonGroup appeared aligned to the right exactly as I wanted it to.
We decided now to place the Control in the XamRibbon's TabItemAreaToolbar (next to the MS-office like Help Icon).
There it is right aligned by default.
But I certainly keep the nice sample to be prepared for some changing-minds of managers how may suddenly want it to have bigger and at the right side of the Ribbon area again....