
I have 3 tabs in my ribbon: File, Analysis and View.
I always want the ribbon visible (maximized), except when "File" is selected, in that case I don't want the File ribbon visible (like Office 2010).
Here's what I tried:And on code behind:
It partially works... when I select View or Analysis, the ribbon stays open, but when I select "File", it also stays open. It minimizes if I click anywhere outside the ribbon, but I wanted the ribbon to minimize as soon as I clicked on "File".
I always want the ribbon visible (maximized), except when "File" is selected, in that case I don't want the File ribbon visible (like Office 2010).
Here's what I tried:
<ribbon:Ribbon.Tabs>
<!-- "File" Tab -->
<ribbon:Tab Label="File" StaysOpenOnClick="False" >
</ribbon:Tab>
<!-- "Analysis" Tab -->
<ribbon:Tab Label="Analysis" StaysOpenOnClick="True">
</ribbon:Tab>
<!-- "View" Tab -->
<ribbon:Tab Label="View" StaysOpenOnClick="True">
</ribbon:Tab>
</ribbon:Ribbon.Tabs>
private void RibbonSelectedTabChanged(object sender, TabPropertyChangedRoutedEventArgs e)
{
if (tabWorkArea != null)
{
if (e.NewValue.Name == "ribbonFile")
{
tabWorkArea.SelectedIndex = 0;
ribbon.IsMinimized = true;
}
else
{
tabWorkArea.SelectedIndex = 1;
ribbon.IsMinimized = false;
}
}
}