[英]WPF RibbonComboBox items listed vertically
I am working on some XAML where I have a RibbonComboBox: 我正在开发一些我有一个RibbonComboBox的XAML:
<RibbonComboBox SelectionBoxWidth="150" Grid.Row="0">
<RibbonGallery SelectedItem="{Binding SelectedUtilityRun, Mode=TwoWay}">
<RibbonGalleryCategory ItemsSource="{Binding UtilityRunLabels}" />
</RibbonGallery>
</RibbonComboBox>
When it displays, it shows the items horizontally rather than vertically as I expected: 当它显示时,它按照我的预期水平而不是垂直显示项目:
How do I style it to place the items vertically? 如何设置样式以垂直放置项目?
尝试将RibbonGallery.MaxColumnCount
设置为1:
<RibbonGallery ... MaxColumnCount="1">
Set ItemsPanel in Style and Set Orientation=Vertical 在样式中设置ItemsPanel并设置方向=垂直
<Style TargetType="RibbonComboBox">
<Setter Property="ItemsPanel">
<Setter.Value>
<ItemsPanelTemplate>
<StackPanel Orientation="Vertical"
VerticalAlignment="Center"
HorizontalAlignment="Center"/>
</ItemsPanelTemplate>
</Setter.Value>
I hope this will help. 我希望这将有所帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.