The order in which groups shrink to smaller states or collapse is completely configurable by assigning priorities to the states of the groups. But before going deeper into the layout and its settings, let's take a look at the states a ribbon group commonly has:
Initially all ribbon groups try size to their InitialState which is by default - Large. If there's not enough space available to place all groups in their initial state, then the layout engine starts shrinking groups to smaller states in the order defined by their priority in descending order - i.e. states with larger priority are shrinked first. If the states of two groups have the same priority then collapsing is done from right to left. By default the priority of all states of all groups is 1. To set the priority of the given group state, you should use the SetStatePriority method of the ribbon group:
Setting Group State Priorities |
Copy Code
|
---|---|
ribbonGroup.SetStatePriority(ENRibbonGroupState.Medium, 4); ribbonGroup.SetStatePriority(ENRibbonGroupState.Small, 3); ribbonGroup.SetStatePriority(ENRibbonGroupState.Collapsed, 2); |
The source code above sets the priority of the Medium, Small and Collapsed state of a ribbon group to values more than 1, which means, that this group will be shrinked before the other groups in the selected ribbon tab page