The following is the scenario:
When the ribbon is not minimized, showing a tab linked to a RibbonContextualTabGroup
works fine, as visible in the following screenshot.
When the ribbon is minimized, showing a tab linked to a RibbonContextualTabGroup
shows the tabs, but not the contextual tab group header, as visible in the following screenshot.
If the ribbon is minimized, but the popup is open, showing a tab linked to a RibbonContextualTabGroup
works fine, as visible in the following screenshot. (The popup is not visible, but that is how I created the scenario.)
WebMatrix also has this problem, so I am assuming that Microsoft developers intentionally coded in this functionality. In Windows 8/Office 2013, however, the contextual tab groups always show, regardless of the state of the ribbon.
I am using the .NET 4.0 RibbonControlsLibrary from Microsoft, so I have access to the full source code. How can I modify the code to force the contextual tab groups to always show, regardless of the state of the ribbon?
Yes, really good, thank you very much, Ming!
Is there a way to use RibbonContextualTabGroupItemsControl.cs without copying and overriding all relating ribbon-source-classes?
I followed again the approach overriding the ribbon style to avoid this extensive work and was finally successful
There is a trigger that handles the IsMinimized-property of the ribbon:
<Trigger Property="IsMinimized" Value="True">
<Setter Property="Content" TargetName="mainItemsPresenterHost" Value="{x:Null}"/>
<Setter Property="Visibility" TargetName="mainItemsPresenterHost" Value="Collapsed"/>
<Setter Property="Content" TargetName="popupItemsPresenterHost" Value="{Binding ElementName=groupsBorder}"/>
<Setter Property="BorderThickness" TargetName="BackgroundBorder" Value="0,0,0,1"/>
</Trigger>
The content of mainItemsPresenterHost-control is a border named 'groupsBorder' that contains all ribbon tabs. When the IsMinimized-property changes to true, this border is moved to the popup presenter named 'popupItemsPresenterHost'.
An other trigger handles the IsDropDownOpen-property:
<Trigger Property="IsDropDownOpen" Value="True">
<Setter Property="BorderThickness" TargetName="BackgroundBorder" Value="0"/>
/Trigger>
I changed both trigger as follows:
<Trigger Property="IsMinimized" Value="True">
<!--<Setter Property="Content" TargetName="mainItemsPresenterHost" Value="{x:Null}"/>-->
<!--<Setter Property="Visibility" TargetName="mainItemsPresenterHost" Value="Collapsed"/>-->
<Setter Property="Height" TargetName="mainItemsPresenterHost" Value="0"/>
<!--<Setter Property="Content" TargetName="popupItemsPresenterHost" Value="{Binding ElementName=groupsBorder}"/>-->
<Setter Property="BorderThickness" TargetName="BackgroundBorder" Value="0,0,0,1"/>
</Trigger>
<Trigger Property="IsDropDownOpen" Value="True">
<Setter Property="BorderThickness" TargetName="BackgroundBorder" Value="0,0,0,1"/>
<Setter Property="Content" TargetName="mainItemsPresenterHost" Value="{x:Null}"/>
<Setter Property="Content" TargetName="popupItemsPresenterHost" Value="{Binding ElementName=groupsBorder}"/>
</Trigger>
Note that i have replaced the setter of the Visibility-property of the mainItemsPresenterHost-control with the Height-property and set it to '0'.