There appears to be a bug in the ribbon control setting the RibbonTabItem's visibility using databinding.
If you set the first tab's Visibility to "Collapsed" using databinding, the tab is removed from the ribbon but it's contents are displayed instead of the next tab's contents. This only occurs with databinding. If you set the visibility without databinding, everything works properly. This is only a problem with the first tab. All other tabs work fine.
This also occurs if you set the Visibility to Hidden. The tab is hidden but the tab's contents are displayed.
Here is my xaml:
<Window x:Class="RibbonVisibilityTest.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:igRibbon="http://infragistics.com/Ribbon" Title="MainWindow" DataContext="{Binding RelativeSource={RelativeSource Self}}"> <StackPanel> <igRibbon:XamRibbon> <igRibbon:RibbonTabItem Header="Tab1" Visibility="{Binding TabVisibility}"> <igRibbon:RibbonGroup Caption="Group1"> <igRibbon:ButtonTool Caption="Button1" /> </igRibbon:RibbonGroup> </igRibbon:RibbonTabItem> <igRibbon:RibbonTabItem Header="Tab2"> <igRibbon:RibbonGroup Caption="Group2"> <igRibbon:ButtonTool Caption="Button2" /> </igRibbon:RibbonGroup> </igRibbon:RibbonTabItem> </igRibbon:XamRibbon> </StackPanel></Window>
TabVisibility is a dependency property in the codebehind.
Hello,
Which version of our product you are using? Because I wasn't able to reproduce this issue.
I bind the first tab visibility to my custom object with "System.Windows.Visibility TabVisibility" property and everything works fine.
Regards,
Anastas
I'm using 10.3 with SR 2096.
Here is what I'm seeing. In the first image, Tab1 is collapsed but it's contents are displayed. The second image is when I set it in the xaml. Tab2 is selected automatically and it's contents are displayed. When I databind the Visibility of Tab1, Tab2 isn't selected automatically like it is when I set it in xaml.
Hi,
I noticed that if I set visibility of tab to collapsed(without binding) and start the project - automatically the next tab is selected.
So if add this code in ribbon's Loaded event I think will help you:
if (ribbon.SelectedTab.Visibility == System.Windows.Visibility.Collapsed)
{
ribbon.SelectNextTab();
}
Thanks Anastas. That works. I was thinking the same thing, but I was hoping I wouldn't have to add any code to fix a bug in the control. I'm also using MVVM and would prefer not to have codebehind but if it can't be fixed than I guess I'll have to use your solution.
Dave
Hello Dave,
I have created the following case for you: CAS-61260-Y5T3DT . We have already logged this behavior into our system under the following number: 66436.
If you have any other questions please do not hesitate to contact us through the case or here in the forum.