TabControl不会拉伸
我无法在选项卡控件内获取选项卡控件以填充其容器。我认为这是我忽略或尚未发现的一些简单属性。在下面的 xaml 中,我希望 TabControl 'sub' 完全填充画布 'canvas2'。
谢谢你, 文卡特
<Border BorderBrush="AliceBlue" BorderThickness="1,1,1,1">
<TabControl name="Main">
<TabItem Header="Test1">
<DockPanel LastChildFill="True">
<Border BorderBrush="Green" BorderThickness="1,1,1,1">
<Canvas Width="350" Height="200" DockPanel.Dock="Left">
</Canvas>
</Border>
<Border BorderBrush="Red" BorderThickness="1,1,1,1">
<Canvas name="canvas2">
<Border BorderBrush="Yellow" BorderThickness="1,1,1,1">
<TabControl Height="600" HorizontalAlignment="Stretch" name="sub">
<TabItem Header="Rights Test 1" HorizontalAlignment="Stretch">
<Canvas></Canvas>
</TabItem>
<TabItem Header="Rights Test 2">
<Canvas></Canvas>
</TabItem>
</TabControl>
</Border>
</Canvas>
</Border>
</DockPanel>
</TabItem>
</TabControl>
</Border>
<代码>
I am failing at getting a tab control inside a tab control to fill its container. I think it is some simple property I am overlooking or have not found yet. In the xaml below I would like the TabControl 'sub' to completely fill the canvas 'canvas2'.
Thank You,
Venkat
<Border BorderBrush="AliceBlue" BorderThickness="1,1,1,1">
<TabControl name="Main">
<TabItem Header="Test1">
<DockPanel LastChildFill="True">
<Border BorderBrush="Green" BorderThickness="1,1,1,1">
<Canvas Width="350" Height="200" DockPanel.Dock="Left">
</Canvas>
</Border>
<Border BorderBrush="Red" BorderThickness="1,1,1,1">
<Canvas name="canvas2">
<Border BorderBrush="Yellow" BorderThickness="1,1,1,1">
<TabControl Height="600" HorizontalAlignment="Stretch" name="sub">
<TabItem Header="Rights Test 1" HorizontalAlignment="Stretch">
<Canvas></Canvas>
</TabItem>
<TabItem Header="Rights Test 2">
<Canvas></Canvas>
</TabItem>
</TabControl>
</Border>
</Canvas>
</Border>
</DockPanel>
</TabItem>
</TabControl>
</Border>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
画布不会拉伸以填充其给定的空间。所以摆脱canvas2。
Canvas's do not stretch to fill their given space. So get rid of canvas2.