【发布时间】:2017-10-14 07:56:31
【问题描述】:
所以我创建了一个基本的 WPF 应用程序,并且我的部分控件放在屏幕左侧的 DockPanel 中。我试图在停靠面板的顶部放置一个组合框,该组合框延伸到面板的宽度。然后,在其下方,一些数据的列表视图。问题是列表视图是在组合框旁边而不是在其下方创建的,将其切成两半。代码如下:
<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>
【问题讨论】: