0
如果不写小说就很难制定这个问题......如何修复DataTemplate网格的大小和中心可见内容?
我在样式中有一个DataTemplate(应用于TabItem,如果有的话),它提供了一个垂直方式包含两个TextBlocks的Grid。
我希望能有我的电网保持相同大小(高度,在这种情况下)和第一TextBlock的中心(此处,垂直)时第二TextBlock中被折叠(或隐藏,我不在乎)。
我怎样才能做到这一点?
这里是我迄今为止(文本值占位符这里,他们应该是绑定):
<Style TargetType="{x:Type TabControl}" x:Key="FlatTabControl">
<Style.Resources>
<Style TargetType="{x:Type TabItem}">
<Setter Property="HeaderTemplate">
<Setter.Value>
<DataTemplate>
<Grid>
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<TextBlock VerticalAlignment="Center" Text="TOP/MIDDLE"/>
<TextBlock Grid.Row="1" Foreground="Green" Text="BOTTOM/COLLAPSED"/>
</Grid>
</DataTemplate>
</Setter.Value>
</Setter>
</Style>
</Style.Resources>
</Style>
这是想法,但我没有设置我的全局字体大小,所以我不能只设置'Height =“30”'。 – Kilazur 2015-04-02 14:56:40