我有一个由Header,Main Content和Footer构成的shell窗口。 主要内容是选项卡控件。 根据设计,其中一个标签项内容(用户控件)需要在页脚上稍微扩展一下。 起初我想过用一个负边距来表示这个,但无论我做什么总是得到我的内容。
例如,请考虑以下xaml:
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="33*"/>
<RowDefinition Height="33*"/>
<RowDefinition Height="33*"/>
</Grid.RowDefinitions>
<StackPanel Background="Blue" Grid.Row="0"/> <!-- Header -->
<StackPanel Background="Red" Grid.Row="2"/> <!-- Footer -->
<TabControl Grid.Row="1" > <!-- Content -->
<TabItem>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="33*"/>
<ColumnDefinition Width="33*"/>
<ColumnDefinition Width="33*"/>
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="1" Background="Yellow" >
<Button Width="100" Height="50" Content="Text" />
</StackPanel>
</Grid>
</TabItem>
</TabControl>
我想要实现的是让黄色StackPanel到达屏幕的底部,重叠在红色页脚的顶部。
希望这是可以理解的。 谢谢 爱丽儿
答案 0 :(得分:4)
试试这段代码示例:
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="33*"/>
<RowDefinition Height="33*"/>
<RowDefinition Height="33*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="33*"/>
<ColumnDefinition Width="33*"/>
<ColumnDefinition Width="33*"/>
</Grid.ColumnDefinitions>
<StackPanel Grid.ColumnSpan="3" Background="Blue" Grid.Row="0"/> <!-- Header -->
<StackPanel Grid.ColumnSpan="3" Background="Red" Grid.Row="2"/> <!-- Footer -->
<TabControl Grid.ColumnSpan="3" Grid.Row="1"> <!-- Content -->
<TabItem>
<Grid>
<Button Width="100" Grid.Column="1" Height="50" Content="Text" />
</Grid>
</TabItem>
</TabControl>
<StackPanel Grid.Column="1" Grid.Row="3" Background="Yellow" />
</Grid>
答案 1 :(得分:1)
问题是您希望tabPanel包含在选项卡控件中,但是您希望它扩展到选项卡控件的底部。选项卡控件不支持此功能。
答案 2 :(得分:1)
毫无疑问TabControl就是问题所在。也许尝试编写自己的TabControl。
干杯。