我试图把一些内容我的TabItem里面,但我不能添加一个容器,填充的TabItem的空间。凡是我加入演出了居中。
I'm trying to put some content inside my TabItem, but I can't add a container that fills the space of the TabItem. Anything that I add shows up centered.
我使用从WPF工具包一个主题( WhistlerBlue.xaml 的),所以我想,也许这是什么原因造成了我这个问题。
I'm using a Theme from WPF Toolkit (WhistlerBlue.xaml), so I think that maybe it's that what is causing me this issue.
我无法删除的主题,因为我需要它。最多我可以改变的东西在里面,但我新的WPF,不知道是什么,我应该改变。
I cannot remove the Theme, because I need it. At most I could change something in it, but I'm new to WPF, and don't know what should I be changing.
我的TabControl看起来是这样的:
My TabControl looks like this:
<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中,我怎么得到的TabItem的内容来填充可用空间?
有人能帮助我吗? 谢谢你。
Can someone help me? Thanks.
推荐答案
好吧,我找到了答案。
主题的的的.xaml 的开始与这些设置TabItem的:
The .xaml of the theme started with these settings for TabItem:
<Style d:IsControlPart="True" TargetType="{x:Type TabItem}">
<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
我已经改变了的中心为拉伸,然后问题就解决了。
I've changed Center to Stretch, and the problem was solved.
我真的需要从书中学习WPF,而不是仅仅尝试的事情了。
I really need to learn WPF from a book, instead of just trying things out.
相关推荐
最新文章