Reputation: 1439
I have RibbonControlGroup with a few buttons.
<r:RibbonControlGroup>
<r:RibbonToggleButton Label="button1"/>
<r:RibbonToggleButton Label="button2"/>
</r:RibbonControlGroup>
On Ribbon buttons are arranged horizontally. Like (button1|button2). How to arrange the buttons vertically?
Upvotes: 1
Views: 3249
Reputation: 37770
I know, that I'm late to party, but may be this will help someone.
Since the RibbonControlGroup
is an ItemsControl
, the right way to go is to replace ItemsPanel
like this:
<r:RibbonControlGroup>
<r:RibbonControlGroup.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Vertical" />
</ItemsPanelTemplate>
</r:RibbonControlGroup.ItemsPanel>
<!-- Group items are listed below: -->
<r:RibbonToggleButton Label="button1"/>
<r:RibbonToggleButton Label="button2"/>
</r:RibbonControlGroup>
This approach conceptually differs from @Sajeetharan's answer, because he creates a group with a single child - StackPanel
, while my sample still is an equivalent of the code, posted in the question: here's a group with two children of type RibbonToggleButton
.
The difference will be meaningful with data binding scenarios, when items of group be populated dynamically through data binding expression.
Upvotes: 2
Reputation: 222572
Use StackPanel and change the orientation to Vertical ,
<r:RibbonControlGroup>
<StackPanel Orientation="Vertical">
<r:RibbonToggleButton Label="button1"/>
<r:RibbonToggleButton Label="button2"/>
</StackPanel>
</r:RibbonControlGroup>
Upvotes: 0
Reputation: 629
You can keep these controls in a container and set its Orientation property to "Vertical" For e.g. using StackPanel as a container
will place the buttons vertically
Upvotes: 0