所以我在 TabControl
中有这个 ListView
:
<TabControl>
<TabItem Width="70" Height="70" Margin="0,0,0,0">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="10"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="10"/>
</Grid.ColumnDefinitions>
<Grid Grid.Column="1">
<Grid Grid.Row="1">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid Grid.Row="1">
<ListView>
...
</ListView>
</Grid>
<Grid>
</Grid>
</Grid>
</TabItem>
</TabControl>
我的窗口重新izemode是CanResizeWithGrip
,当我调整应用程序大小时,我希望我的ListView
自动根据我的Window
宽度调整大小。
我尝试定义我的 ListView
HorizontalAlignment
Stretch
bu当我的应用程序宽度改变我的 ListView
时。
我相信,由于您的ListView
嵌套在其他控件中,因此这些控件需要将其HorizontalAlignment
设置为Stretch
。我现在正在使用手机,所以当我回到家时,我会在系统上尝试您的XAML,如果发现其他东西是罪魁祸首。
编辑:我将您的代码复制到VS中,并适当地伸展了我的代码。我没有任何内容可以检查,但是如果我设置
<TabControl>
<TabItem Width="70" Height="70" Margin="0,0,0,0">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="10"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="10"/>
</Grid.ColumnDefinitions>
<Grid Grid.Column="1">
<Grid Grid.Row="1">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid Grid.Row="1">
<ListView Background="Black">
</ListView>
</Grid>
</Grid>
</Grid>
</Grid>
</TabItem>
</TabControl>
我可以看到,当我调整窗口大小时,该控件实际上正在伸展。现在,我不确定您遇到的问题是什么。您有机会发布更多详细信息吗?