我正在开发一些我有一个RibbonComboBox的XAML:
<RibbonComboBox SelectionBoxWidth="150" Grid.Row="0">
<RibbonGallery SelectedItem="{Binding SelectedUtilityRun, Mode=TwoWay}">
<RibbonGalleryCategory ItemsSource="{Binding UtilityRunLabels}" />
</RibbonGallery>
</RibbonComboBox>
当它显示时,它按照我的预期水平而不是垂直显示项目:
如何设置样式以垂直放置项目?
答案 0 :(得分:5)
尝试将RibbonGallery.MaxColumnCount
设置为1:
<RibbonGallery ... MaxColumnCount="1">
答案 1 :(得分:3)
在样式中设置ItemsPanel并设置方向=垂直
<Style TargetType="RibbonComboBox">
<Setter Property="ItemsPanel">
<Setter.Value>
<ItemsPanelTemplate>
<StackPanel Orientation="Vertical"
VerticalAlignment="Center"
HorizontalAlignment="Center"/>
</ItemsPanelTemplate>
</Setter.Value>
我希望这会有所帮助。