[英]WPF GridSplitter TabHeader Positioning
I have the following grid structure in my app: 我的应用程序具有以下网格结构:
I want the 2 TabHeader Groups to be aligned side by side above the horizontal GridSplitter... 我希望2个TabHeader组在水平GridSplitter上方并排对齐...
Anyone any Ideas? 任何人有想法吗? I'm stuck here somehow... 我被卡在这里...
Set the Top Margin of the lower tab to a negative number to have it extend above of its location in the grid. 将下部选项卡的“上边距”设置为负数,以使其延伸到其在网格中位置的上方。 Place the GridSplitter beneath it, setting it to resize the rows and stretch horizontally (I used a blue background to make it visible). 将GridSplitter放置在其下方,设置其大小以调整行的大小并水平拉伸(我使用蓝色背景使其可见)。
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition Width="10"></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
<RowDefinition Height="10"></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<!-- Set the GridSplitter's ResizeDirection to Rows, and its HorizontalAlignment to Stretch -->
<GridSplitter Grid.Row="1" Grid.Column="0" Height="2" ResizeDirection="Rows" HorizontalAlignment="Stretch" Background="Blue"></GridSplitter>
<!-- Place the upper TabControl's tabs on the bottom and aligned to the right. -->
<TabControl Grid.Column="0" Grid.Row="0" TabStripPlacement="Bottom">
<TabControl.Resources>
<Style TargetType="TabPanel">
<Setter Property="HorizontalAlignment" Value="Right"/>
</Style>
</TabControl.Resources>
<TabItem Header="Item 1"></TabItem>
<TabItem Header="Item 2"></TabItem>
<TabItem Header="Item 3"></TabItem>
</TabControl>
<!-- Set the lower TabControl's top margin to -30 to extend up out of its location in the grid. -->
<TabControl Grid.Column="0" Grid.Row="2" Margin="0, -30, 0, 0">
<TabItem Header="Item 1"></TabItem>
<TabItem Header="Item 2"></TabItem>
<TabItem Header="Item 3"></TabItem>
</TabControl>
</Grid>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.