0
所以我创建了一个基本的WPF应用程序,并将一部分控件放在屏幕左侧的DockPanel中。我正试图在dockpanel的顶部放置一个combobox,它延伸到面板的宽度。然后,在那之下,一些数据的列表视图。问题是listview创建在组合框旁边而不是在它下面,将它切成两半。代码如下:如何在DockPanel(WPF)中的对象之间创建垂直空间?
<DockPanel VerticalAlignment="Bottom" HorizontalAlignment="Left" Height="422" Width="200">
<ComboBox VerticalAlignment="Top" HorizontalContentAlignment="Stretch" SelectedIndex="0">
<ComboBoxItem Content="Regions/Groups"/>
</ComboBox>
<ListView Height="422" VerticalAlignment="Top" Width="100">
<ListView.View>
<GridView>
<GridViewColumn/>
</GridView>
</ListView.View>
</ListView>
</DockPanel>
,或虽未列表视图代码:
<DockPanel VerticalAlignment="Bottom" HorizontalAlignment="Left" Height="422" Width="200">
<ComboBox VerticalAlignment="Top" HorizontalContentAlignment="Stretch" SelectedIndex="0">
<ComboBoxItem Content="Regions/Groups"/>
</ComboBox>
</DockPanel>
Aaaaaand我觉得很蠢,你已经修好了。这非常简单。谢谢! –