Hi, can you please outline how to achieve the following behaviour:
we want only the application tab in the ribbon visible at start, and no other ribbon tab should be selectable until the user selects something in the application tab.
I could hide the other tabs using visibility = hidden or collapsed, however, the other tabs would still be there and if I clicked on "Start" twice, the application would auto-jump to the first tab, even if it were set to hidden or collapsed. That is not what I would expect if the tab is set to collapsed.
I guess the solution would be to add the tabs afterwards, after the event (user has seleted something) has occured. How could I do so or is there a better way?
Hi Lucas,
The ApplicationMenu has a Closed event. Handle this event and inside check to see if the ribbon has any tabs. If it has no tabs then set IsOpen back to true.
private void ApplicationMenu2010_Closed(object sender, RoutedEventArgs e){ if (xamRibbon1.Tabs.Count == 0) (sender as ApplicationMenu2010).IsOpen = true;}
If I start your sample application and click on the dark blue application tab, the app navigates to an empty ribbon. How can I prevent this behaviour? It does not make sense to jump to an empty ribbon and it might confuse users.
Hi Kurt,
The ApplicationMenu has an IsOpen property. Just set that to true when the ribbon is loaded.
As for as adding tabs to the ribbon dynamically, if you create a separate XAML file for each tab it should work fine. Take a look at my new sample.
Hi Rob,
I think it would be enough if I could turn off the default behaviour that leads to a toggle between the first ribbon and the application tab when you click on the header of the application tab (the dark blue part in your sample application). How can I turn this off?
Thank you very much.
in addition to my comment:
what I have tried to do to no success is to copy a RibbonTabItem to its own file and then, in the code behind, do something like
MyRibbon.Tabs.Add(new MyRibbonTabItem);
I guess it's actually pretty simple, however I did not manage to get this done. Thanks for your help.