在我的应用程序中,我最近试图在外观方面进行爵士乐,因此我尝试使用MahApps.Metro
。但是我遇到了一点障碍。无法样式TabControl
在我的申请中,我有一个tabcontrol
,我已经使用了style
作为以下;
<Page.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<!--Resource dictionary for mahapps. -->
</ResourceDictionary.MergedDictionaries>
<Style TargetType="{x:Type TabItem}">
<Setter Property="HeaderTemplate">
<Setter.Value>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<!-- FormName is the name of the ViewModel-->
<TextBlock Text="{Binding FormName}" VerticalAlignment="Center" Margin="2" />
</StackPanel>
<DataTemplate.Triggers>
<DataTrigger Binding="{Binding IsValid}"
Value="False">
</DataTrigger>
</DataTemplate.Triggers>
</DataTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>
</Page.Resources>
<!-- The itemsource that is bound to is a ObservableCollection of Forms that are used to validate for a Progress bar, It uses the ViewModels-->
<TabControl x:Name="tabcontrol"
Grid.Row="1"
ItemsSource="{Binding Forms}"
SelectedIndex="0" BorderBrush="Black" />
显然,这是不使用MahApps.Metro
tabcontrol
。不过,在tabcontrol
的style
内,我将TargetType
更改为以下内容,但它会导致Page
中的所有内容都增加其大小,并将两个制表符内容合并为一个;
<Style TargetType="{x:Type Controls:MetroTabItem}" BasedOn="{StaticResource MetroTabItem}">
任何帮助将是关于帮助我实现MahApps.Meto
tab control
和清理什么,我做错了感激。干杯。
感谢@Maverik!到底需要什么! :) –