我有非常简单的 xaml。
<Grid Margin="0,50,0,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="30*" />
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<!--<RowDefinition Height="50"/>-->
</Grid.RowDefinitions>
<Expander Header=""
HorizontalAlignment="Left"
VerticalAlignment="Stretch"
ExpandDirection="Right"
IsExpanded="True"
Grid.Column="0"
Grid.Row="0"
Height="Auto"
>
<!-- My List control -->
</Expander>
<TabControl Name="ExecutionTab" Grid.Column="1" Grid.Row="0" HorizontalAlignment="Stretch">
<!-- soem tabs here -->
</TabControl>
</Grid>
现在,在折叠扩展器之后,左侧部分 [row=0,col=0] 显示为带有空格的空白。我们想要的是正确的部分 [row=0,col=1] 应该占据整个空间。
在这种情况下应该怎么做?我已尝试将 HorizontalAlignment="Stretch" 设置为 Tab 控件,但无法正常工作。
我是否需要在折叠时添加事件处理程序并更改网格的宽度..但这似乎不是一个好方法?
任何人都可以提出更好的方法吗?
谢谢