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 Kurt,
I'm not sure what clicking on "Start" twice means but when I run a sample app with the XamRibbon in it and hide the tabs, I can still see the first tab content even though the tab header is not there. You can resolve this by adding an empty tab in front of all the other tabs in the list. Then based on the selection the user makes in the application menu you can enable the other tabs.
Take a look at my attached sample.
Hi Rob,
thanks for your quick reply. This is not what I need, I don't want to show an empty ribbon or a ribbon tab at all until the user has made a selection in the application menu. I am looking for a way to add a ribbon tab after the user has made the selection.
I hope you can help me with that, best regards,
Kurt
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.
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.
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.
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 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;}