开发者

How to dock ListView on a StackPanel?

开发者 https://www.devze.com 2022-12-12 10:27 出处:网络
<StackPanel Grid.Row=\"0\" Height=\"Auto\" Width=\"Auto\"> <Label Name=\"Label1\" BorderThickness=\"2,2,2,2\" BorderBrush=\"Gray\" HorizontalContentAlignment=\"Center\" Width=\"Auto\" Height=
<StackPanel Grid.Row="0" Height="Auto" Width="Auto">
    <Label Name="Label1" BorderThickness="2,2,2,2" BorderBrush="Gray" HorizontalContentAlignment="Center" Width="Auto" Height="28">Window1</Label>               
    <ListView BorderThickn开发者_StackOverflow社区ess="2,0,2,0" BorderBrush="Gray"Height="Auto" Width="Auto" />                                   
</StackPanel>

In the XAML above , I want to dock the ListView on the StackPanel. I want the ListView to take the entire client area of the StackPanel after the Label.

What am I doing wrong ?


Why not use a DockPanel instead

<DockPanel Grid.Row="0" Height="Auto" Width="Auto">
     <Label DockPanel.Dock="Left" Name="Label1" BorderThickness="2,2,2,2" BorderBrush="Gray"  HorizontalContentAlignment="Center" Width="Auto" Height="28">Window1</Label>               
     <ListView BorderThickness="2,0,2,0" BorderBrush="Gray" Height="Auto" Width="Auto" />
</DockPanel>
0

精彩评论

暂无评论...
验证码 换一张
取 消