Fixing TabControl TabItem lightweight styling options

This commit is contained in:
Dipesh Kumar 2024-10-15 17:59:33 +05:30
Родитель 442429b9ae
Коммит f27f15c6af
4 изменённых файлов: 30 добавлений и 10 удалений

Просмотреть файл

@ -5,7 +5,9 @@
All Rights Reserved.
-->
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:sys="clr-namespace:System;assembly=mscorlib">
<!-- Styles when TabItems are on the Top -->
<ControlTemplate x:Key="DefaultTopTabControlStyle" TargetType="{x:Type TabControl}">
@ -207,6 +209,11 @@
</Style.Triggers>
</Style>
<sys:Double x:Key="TabItemHeaderMinHeight">32</sys:Double>
<sys:Double x:Key="TabItemHeaderMinWidth">100</sys:Double>
<sys:Double x:Key="TabItemHeaderFontSize">14</sys:Double>
<Thickness x:Key="TabItemHeaderPadding">8,6,8,6</Thickness>
<Style TargetType="{x:Type TabItem}">
<Setter Property="Background" Value="{DynamicResource TabViewItemHeaderBackground}" />
<Setter Property="BorderBrush" Value="Transparent" />
@ -225,10 +232,10 @@
<Grid x:Name="Root">
<Border
x:Name="Border"
MinWidth="180"
MinHeight="36"
MinWidth="{DynamicResource TabItemHeaderMinWidth}"
MinHeight="{DynamicResource TabItemHeaderMinHeight}"
Margin="0"
Padding="6"
Padding="{DynamicResource TabItemHeaderPadding}"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="1,1,1,0"
@ -238,6 +245,7 @@
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
ContentSource="Header"
TextElement.FontSize="{DynamicResource TabItemHeaderFontSize}"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
Margin="{TemplateBinding Padding}"
RecognizesAccessKey="True" />

Просмотреть файл

@ -4047,6 +4047,10 @@
</Trigger>
</Style.Triggers>
</Style>
<sys:Double x:Key="TabItemHeaderMinHeight">32</sys:Double>
<sys:Double x:Key="TabItemHeaderMinWidth">100</sys:Double>
<sys:Double x:Key="TabItemHeaderFontSize">14</sys:Double>
<Thickness x:Key="TabItemHeaderPadding">8,6,8,6</Thickness>
<Style TargetType="{x:Type TabItem}">
<Setter Property="Background" Value="{DynamicResource TabViewItemHeaderBackground}" />
<Setter Property="BorderBrush" Value="Transparent" />
@ -4063,8 +4067,8 @@
<Setter.Value>
<ControlTemplate TargetType="{x:Type TabItem}">
<Grid x:Name="Root">
<Border x:Name="Border" MinWidth="180" MinHeight="36" Margin="0" Padding="6" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="1,1,1,0" CornerRadius="8,8,0,0">
<ContentPresenter x:Name="ContentSite" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" ContentSource="Header" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" />
<Border x:Name="Border" MinWidth="{DynamicResource TabItemHeaderMinWidth}" MinHeight="{DynamicResource TabItemHeaderMinHeight}" Margin="0" Padding="{DynamicResource TabItemHeaderPadding}" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="1,1,1,0" CornerRadius="8,8,0,0">
<ContentPresenter x:Name="ContentSite" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" ContentSource="Header" TextElement.FontSize="{DynamicResource TabItemHeaderFontSize}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" />
</Border>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="SelectionStates">

Просмотреть файл

@ -4008,6 +4008,10 @@
</Trigger>
</Style.Triggers>
</Style>
<sys:Double x:Key="TabItemHeaderMinHeight">32</sys:Double>
<sys:Double x:Key="TabItemHeaderMinWidth">100</sys:Double>
<sys:Double x:Key="TabItemHeaderFontSize">14</sys:Double>
<Thickness x:Key="TabItemHeaderPadding">8,6,8,6</Thickness>
<Style TargetType="{x:Type TabItem}">
<Setter Property="Background" Value="{DynamicResource TabViewItemHeaderBackground}" />
<Setter Property="BorderBrush" Value="Transparent" />
@ -4024,8 +4028,8 @@
<Setter.Value>
<ControlTemplate TargetType="{x:Type TabItem}">
<Grid x:Name="Root">
<Border x:Name="Border" MinWidth="180" MinHeight="36" Margin="0" Padding="6" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="1,1,1,0" CornerRadius="8,8,0,0">
<ContentPresenter x:Name="ContentSite" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" ContentSource="Header" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" />
<Border x:Name="Border" MinWidth="{DynamicResource TabItemHeaderMinWidth}" MinHeight="{DynamicResource TabItemHeaderMinHeight}" Margin="0" Padding="{DynamicResource TabItemHeaderPadding}" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="1,1,1,0" CornerRadius="8,8,0,0">
<ContentPresenter x:Name="ContentSite" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" ContentSource="Header" TextElement.FontSize="{DynamicResource TabItemHeaderFontSize}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" />
</Border>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="SelectionStates">

Просмотреть файл

@ -4048,6 +4048,10 @@
</Trigger>
</Style.Triggers>
</Style>
<sys:Double x:Key="TabItemHeaderMinHeight">32</sys:Double>
<sys:Double x:Key="TabItemHeaderMinWidth">100</sys:Double>
<sys:Double x:Key="TabItemHeaderFontSize">14</sys:Double>
<Thickness x:Key="TabItemHeaderPadding">8,6,8,6</Thickness>
<Style TargetType="{x:Type TabItem}">
<Setter Property="Background" Value="{DynamicResource TabViewItemHeaderBackground}" />
<Setter Property="BorderBrush" Value="Transparent" />
@ -4064,8 +4068,8 @@
<Setter.Value>
<ControlTemplate TargetType="{x:Type TabItem}">
<Grid x:Name="Root">
<Border x:Name="Border" MinWidth="180" MinHeight="36" Margin="0" Padding="6" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="1,1,1,0" CornerRadius="8,8,0,0">
<ContentPresenter x:Name="ContentSite" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" ContentSource="Header" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" />
<Border x:Name="Border" MinWidth="{DynamicResource TabItemHeaderMinWidth}" MinHeight="{DynamicResource TabItemHeaderMinHeight}" Margin="0" Padding="{DynamicResource TabItemHeaderPadding}" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="1,1,1,0" CornerRadius="8,8,0,0">
<ContentPresenter x:Name="ContentSite" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" ContentSource="Header" TextElement.FontSize="{DynamicResource TabItemHeaderFontSize}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" />
</Border>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="SelectionStates">