[英]WPF StatusBar with single StatusBarItem and ComboBox to fill the entire width
I have this bit of XAML: 我有一点XAML:
<StatusBar Grid.Row="2">
<StatusBar.ItemsPanel>
<ItemsPanelTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
</Grid>
</ItemsPanelTemplate>
</StatusBar.ItemsPanel>
<StatusBarItem>
<ComboBox ItemsSource="{Binding StatusMessages}"/>
</StatusBarItem>
</StatusBar>
StatusBarItem is taking up the entire width of the window but the combobox within it is still taking up minimal width. StatusBarItem占据了窗口的整个宽度,但其中的组合框仍然占据了最小的宽度。 How do I get it to fill the entire width?
如何获得整个宽度?
尝试将HorizontalContentAlignment = "Stretch"
添加到ComboBox
。
<StatusBar>
<StatusBarItem HorizontalContentAlignment="Stretch">
<ComboBox ItemsSource="{Binding StatusMessages}" SelectedIndex="{Binding SelectedStatusIndex, Mode=OneWay}"/>
</StatusBarItem>
</StatusBar>
This worked 这工作
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.