0
如何將列添加到TabItem中,以便我可以使用拆分器調整列的大小,並讓堆疊在每個列中的控件同時調整大小?使用XAML如何添加列到TabItem
我創建了以下XAML。我認爲分割器已調整大小,按鈕會調整每列的大小。
<Grid Background="LightBlue">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<DockPanel Grid.Row="0" >
<StackPanel>
<TextBlock Text="Multiple items go here as the header" />
</StackPanel>
</DockPanel>
<TabControl Grid.Row="1" Background="Beige" >
<TabItem x:Name="Tab1" Header="Tab One" >
<DockPanel>
<StackPanel DockPanel.Dock="Top">
<TextBlock Text="Header for this tab goes here" />
</StackPanel>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="100" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="100" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<GridSplitter Grid.Column="1" VerticalAlignment="Stretch"
Background="Aqua" Width="4" />
<GridSplitter Grid.Column="3" VerticalAlignment="Stretch"
Background="Aqua" Width="4" />
<StackPanel Grid.Column="0" >
<Button Content="Column 1" />
</StackPanel>
<StackPanel Grid.Column="2" >
<Button Content="Column 2" />
</StackPanel>
<StackPanel Grid.Column="4" >
<Button Content="Column 3" />
</StackPanel>
</Grid>
</DockPanel>
</TabItem>
<TabItem x:Name="Tab2" Header="Tab Two" ></TabItem>
<TabItem x:Name="Tab3" Header="Tab Three" ></TabItem>
</TabControl>
</Grid>