【发布时间】:2010-11-07 08:31:04
【问题描述】:
我正在尝试将一些内容放入我的 TabItem 中,但我无法添加填充 TabItem 空间的容器。我添加的任何内容都会居中显示。
我正在使用 WPF 工具包中的主题 (WhistlerBlue.xaml),所以我认为这可能是导致我出现此问题的原因。
我无法删除主题,因为我需要它。最多我可以更改其中的某些内容,但我是 WPF 新手,不知道我应该更改什么。
我的 TabControl 如下所示:
<TabControl Margin="0,71.25,0,206.25" Name="tabControl1" TabStripPlacement="Left">
<TabItem Name="tabItem1" FlowDirection="LeftToRight" FontSize="22" Height="200" Width="60" >
<TabItem.Header>
<StackPanel Orientation="Horizontal" >
<Image Height="40" Width="40" Margin="20,0,0,0" VerticalAlignment="Center"></Image>
<TextBlock Margin="15,0,25,0" VerticalAlignment="Center" FontWeight="Bold">
Header
</TextBlock>
</StackPanel>
</TabItem.Header>
<TabItem.Content>
<StackPanel HorizontalAlignment="Left" VerticalAlignment="Top" Margin="0,0,0,0" >
<TextBlock>Test</TextBlock>
</StackPanel>
</TabItem.Content>
</TabItem>
</TabControl>
有类似的问题,但没有答案:In WPF, how do I get the content of a tabItem to fill available space?
有人可以帮助我吗? 谢谢。
【问题讨论】:
标签: wpf tabcontrol alignment