<TabView x:Name="tabView" AddTabButtonClick="TabView_AddTabButtonClick" TabCloseRequested="TabView_TabCloseRequested"
SelectionChanged="TabView_SelectionChanged"
HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
<TabView.TabItemTemplate>
<DataTemplate x:DataType="local:MyTabItem">
<TabViewItem Header="{x:Bind HeaderName, Mode=OneWay}" IconSource="{x:Bind IconSource, Mode=OneWay}" Content="{x:Bind Content}">
<TabViewItem.HeaderTemplate>
<DataTemplate>
<TextBlock Text="{Binding}"></TextBlock>
</DataTemplate>
</TabViewItem.HeaderTemplate>
</TabViewItem>
</DataTemplate>
</TabView.TabItemTemplate>
</TabView>
I want to change the background color of TabViewItem header, however, there is no property named HeaderBackground
in TabViewItem
You can define TabViewItemHeaderBackgroundSelected
and TabViewItemHeaderBackground
in Resources.
There are more header properties that can be changed here.
microsoft-ui-xaml/TabView_themeresources.xaml
- TabViewItemHeaderBackground
- TabViewItemHeaderBackgroundSelected
- TabViewItemHeaderBackgroundPointerOver
- TabViewItemHeaderBackgroundPressed
- TabViewItemHeaderBackgroundDisabled
<TabView.Resources>
<ResourceDictionary>
<SolidColorBrush x:Key="TabViewItemHeaderBackgroundSelected" Color="Red"/>
<SolidColorBrush x:Key="TabViewItemHeaderBackground" Color="Red"/>
</ResourceDictionary>
</TabView.Resources>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.