WPF Ribbon: Force RibbonGroup to start a new column

Nov 7, 2008 at 10:26 PM
I have 4 buttons in a group and set the size definitions so that all of these buttons are small.  When the group lays them out, there is one column which contains 3 buttons and the fourth button is in the next column.  What I would like is 2 columns of 2 buttons.  Is there a way to tell the group to "Start a new column"?  Perhaps some hidden property of a size definition?

There are other situations where I would like to do this as well so I would perfer a manual way to get this behavior.
Nov 7, 2008 at 11:46 PM
The default Panel in RibbonGroup which lays out your controls will not do this for you, it is pre-configured to lay out the controls in a certain way.

We've introduced an extensibility mechanism, however, that'll let you do this quite easily.  What you need here is a custom Panel set to your RibbonGroup's ItemsPanel property configured to provide the type of layout you're looking for.  In your case you can use a UniformGrid with two rows, like so:

<RibbonGroup>
<RibbonGroup.ItemsPanel>
<UniformGrid Rows="2" />
</RibbonGroup.ItemsPanel>
<RibbonButton />
<RibbonButton />
<RibbonButton />
<RibbonButton />
</RibbonGroup>

Let me know if you need more information,
-Mike