chore: add TabControlSliding style.

This commit is contained in:
NaBian committed 2022-12-17 19:09:18 +08:00
1 parent 4c4af40b77
commit a21b400d39
7 files changed
+823 -285

No files matched your search

@@ -11038,7 +11038,7 @@
<RowDefinition x:Name="RowDefinition1" Height="*" />
</Grid.RowDefinitions>
<TabPanel x:Name="headerPanel" Background="Transparent" Grid.Column="0" IsItemsHost="true" Margin="0" Grid.Row="0" KeyboardNavigation.TabIndex="1" Panel.ZIndex="1" />
<Border x:Name="contentPanel" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" BorderThickness="{Binding BorderThickness,RelativeSource={RelativeSource TemplatedParent},Converter={StaticResource ThicknessSplitConverter},ConverterParameter='0,1,0,0'}" BorderBrush="{DynamicResource BorderBrush}" Background="{TemplateBinding Background}" Grid.Column="0" KeyboardNavigation.DirectionalNavigation="Contained" Grid.Row="1" KeyboardNavigation.TabIndex="2" KeyboardNavigation.TabNavigation="Local">
<Border x:Name="contentPanel" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{DynamicResource BorderBrush}" Background="{TemplateBinding Background}" Grid.Column="0" KeyboardNavigation.DirectionalNavigation="Contained" Grid.Row="1" KeyboardNavigation.TabIndex="2" KeyboardNavigation.TabNavigation="Local">
<ContentPresenter x:Name="PART_SelectedContentHost" ContentSource="SelectedContent" Margin="0" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
</Border>
</Grid>
@@ -11048,7 +11048,6 @@
<Setter TargetName="RowDefinition1" Property="Height" Value="Auto" />
<Setter TargetName="headerPanel" Property="Grid.Row" Value="1" />
<Setter TargetName="contentPanel" Property="Grid.Row" Value="0" />
<Setter TargetName="contentPanel" Property="BorderThickness" Value="{Binding BorderThickness,RelativeSource={RelativeSource TemplatedParent},Converter={StaticResource ThicknessSplitConverter},ConverterParameter='0,0,0,1'}" />
</Trigger>
<Trigger Property="TabStripPlacement" Value="Left">
<Setter TargetName="RowDefinition0" Property="Height" Value="*" />
@@ -11059,7 +11058,6 @@
<Setter TargetName="headerPanel" Property="Grid.Row" Value="0" />
<Setter TargetName="contentPanel" Property="Grid.Column" Value="1" />
<Setter TargetName="contentPanel" Property="Grid.Row" Value="0" />
<Setter TargetName="contentPanel" Property="BorderThickness" Value="{Binding BorderThickness,RelativeSource={RelativeSource TemplatedParent},Converter={StaticResource ThicknessSplitConverter},ConverterParameter='1,0,0,0'}" />
</Trigger>
<Trigger Property="TabStripPlacement" Value="Right">
<Setter TargetName="RowDefinition0" Property="Height" Value="*" />
@@ -11070,7 +11068,6 @@
<Setter TargetName="headerPanel" Property="Grid.Row" Value="0" />
<Setter TargetName="contentPanel" Property="Grid.Column" Value="0" />
<Setter TargetName="contentPanel" Property="Grid.Row" Value="0" />
<Setter TargetName="contentPanel" Property="BorderThickness" Value="{Binding BorderThickness,RelativeSource={RelativeSource TemplatedParent},Converter={StaticResource ThicknessSplitConverter},ConverterParameter='0,0,1,0'}" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
@@ -11277,6 +11274,29 @@
</MultiTrigger>
</Style.Triggers>
</Style>
<Style x:Key="SlidingTabContainerBaseStyle" TargetType="hc:SlidingTabContainer">
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
<Setter Property="Focusable" Value="False" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="HorizontalAlignment" Value="Center" />
<Setter Property="Padding" Value="2" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="hc:SlidingTabContainer">
<Border HorizontalAlignment="Center" VerticalAlignment="Center" Padding="{TemplateBinding Padding}" Background="{TemplateBinding Background}" CornerRadius="{Binding Path=(hc:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}">
<hc:SimplePanel>
<Border x:Name="PART_Sliding" CornerRadius="{Binding Path=(hc:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" Width="0" Height="0" Effect="{StaticResource EffectShadow1}" Background="{Binding Path=(hc:TitleElement.Background),RelativeSource={RelativeSource TemplatedParent}}" HorizontalAlignment="Left" VerticalAlignment="Top">
<Border.RenderTransform>
<TranslateTransform />
</Border.RenderTransform>
</Border>
<ContentPresenter />
</hc:SimplePanel>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="TimePickerBaseStyle" TargetType="hc:TimePicker">
<Setter Property="Foreground" Value="{DynamicResource PrimaryTextBrush}" />
<Setter Property="hc:BorderElement.CornerRadius" Value="{StaticResource DefaultCornerRadius}" />
@@ -13790,6 +13810,101 @@
<Style BasedOn="{StaticResource StepBarBaseStyle}" TargetType="hc:StepBar" />
<Style BasedOn="{StaticResource TabControlBaseStyle}" TargetType="TabControl" />
<Style BasedOn="{StaticResource TabControlPlusBaseStyle}" TargetType="hc:TabControl" />
<Style x:Key="TabItemSliding" TargetType="TabItem">
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
<Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="Foreground" Value="{DynamicResource PrimaryTextBrush}" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
<Setter Property="VerticalContentAlignment" Value="Stretch" />
<Setter Property="MinHeight" Value="{StaticResource DefaultControlHeight}" />
<Setter Property="Padding" Value="10,0" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="TabItem">
<Border CornerRadius="{Binding Path=(hc:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{DynamicResource BorderBrush}" Background="{TemplateBinding Background}">
<ContentPresenter x:Name="contentPresenter" ContentSource="Header" HorizontalAlignment="Center" VerticalAlignment="Center" TextElement.Foreground="{TemplateBinding Foreground}" Focusable="False" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Opacity" Value=".9" />
</Trigger>
<Trigger Property="IsSelected" Value="true">
<Setter Property="TextElement.Foreground" Value="{Binding Path=(hc:TitleElement.Foreground),RelativeSource={RelativeSource TemplatedParent}}" TargetName="contentPresenter" />
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Opacity" Value="0.4" TargetName="contentPresenter" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style BasedOn="{StaticResource SlidingTabContainerBaseStyle}" TargetType="hc:SlidingTabContainer" />
<Style x:Key="TabControlSliding" TargetType="TabControl">
<Setter Property="BorderThickness" Value="1" />
<Setter Property="Background" Value="{DynamicResource SecondaryRegionBrush}" />
<Setter Property="ItemContainerStyle" Value="{StaticResource TabItemSliding}" />
<Setter Property="hc:BorderElement.CornerRadius" Value="{StaticResource DefaultCornerRadius}" />
<Setter Property="hc:TitleElement.Background" Value="{DynamicResource RegionBrush}" />
<Setter Property="hc:TitleElement.Foreground" Value="{DynamicResource PrimaryTextBrush}" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="TabControl">
<Grid x:Name="templateRoot" ClipToBounds="true" SnapsToDevicePixels="true" KeyboardNavigation.TabNavigation="Local">
<Grid.ColumnDefinitions>
<ColumnDefinition x:Name="ColumnDefinition0" />
<ColumnDefinition x:Name="ColumnDefinition1" Width="0" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition x:Name="RowDefinition0" Height="Auto" />
<RowDefinition x:Name="RowDefinition1" Height="*" />
</Grid.RowDefinitions>
<hc:SlidingTabContainer x:Name="TabContainer" Background="{TemplateBinding Background}" Grid.Row="0" Grid.Column="0">
<StackPanel x:Name="headerPanel" Orientation="Horizontal" Background="Transparent" Margin="0" IsItemsHost="True" />
</hc:SlidingTabContainer>
<Border x:Name="contentPanel" Margin="0,6,0,0" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{DynamicResource BorderBrush}" Grid.Column="0" KeyboardNavigation.DirectionalNavigation="Contained" Grid.Row="1" KeyboardNavigation.TabIndex="2" KeyboardNavigation.TabNavigation="Local">
<ContentPresenter x:Name="PART_SelectedContentHost" ContentSource="SelectedContent" Margin="0" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
</Border>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="TabStripPlacement" Value="Bottom">
<Setter TargetName="RowDefinition0" Property="Height" Value="*" />
<Setter TargetName="RowDefinition1" Property="Height" Value="Auto" />
<Setter TargetName="TabContainer" Property="Grid.Row" Value="1" />
<Setter TargetName="contentPanel" Property="Margin" Value="0,0,0,6" />
<Setter TargetName="contentPanel" Property="Grid.Row" Value="0" />
</Trigger>
<Trigger Property="TabStripPlacement" Value="Left">
<Setter TargetName="RowDefinition0" Property="Height" Value="*" />
<Setter TargetName="RowDefinition1" Property="Height" Value="0" />
<Setter TargetName="ColumnDefinition0" Property="Width" Value="Auto" />
<Setter TargetName="ColumnDefinition1" Property="Width" Value="*" />
<Setter TargetName="contentPanel" Property="Grid.Column" Value="1" />
<Setter TargetName="contentPanel" Property="Grid.Row" Value="0" />
<Setter TargetName="contentPanel" Property="Margin" Value="6,0,0,0" />
<Setter TargetName="TabContainer" Property="Grid.Column" Value="0" />
<Setter TargetName="TabContainer" Property="Grid.Row" Value="0" />
<Setter TargetName="headerPanel" Property="Orientation" Value="Vertical" />
</Trigger>
<Trigger Property="TabStripPlacement" Value="Right">
<Setter TargetName="RowDefinition0" Property="Height" Value="*" />
<Setter TargetName="RowDefinition1" Property="Height" Value="0" />
<Setter TargetName="ColumnDefinition0" Property="Width" Value="*" />
<Setter TargetName="ColumnDefinition1" Property="Width" Value="Auto" />
<Setter TargetName="contentPanel" Property="Grid.Column" Value="0" />
<Setter TargetName="contentPanel" Property="Grid.Row" Value="0" />
<Setter TargetName="contentPanel" Property="Margin" Value="0,0,6,0" />
<Setter TargetName="TabContainer" Property="Grid.Column" Value="1" />
<Setter TargetName="TabContainer" Property="Grid.Row" Value="0" />
<Setter TargetName="headerPanel" Property="Orientation" Value="Vertical" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="TabItemInLine" BasedOn="{StaticResource TabItemStyle}" TargetType="TabItem">
<Setter Property="MinWidth" Value="0" />
</Style>
@@ -13808,7 +13923,7 @@
<RowDefinition x:Name="RowDefinition1" Height="*" />
</Grid.RowDefinitions>
<UniformGrid Rows="1" x:Name="headerPanel" Background="Transparent" Grid.Column="0" IsItemsHost="true" Margin="0" Grid.Row="0" KeyboardNavigation.TabIndex="1" Panel.ZIndex="1" />
<Border x:Name="contentPanel" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" BorderThickness="{Binding BorderThickness,RelativeSource={RelativeSource TemplatedParent},Converter={StaticResource ThicknessSplitConverter},ConverterParameter='0,1,0,0'}" BorderBrush="{DynamicResource BorderBrush}" Background="{TemplateBinding Background}" Grid.Column="0" KeyboardNavigation.DirectionalNavigation="Contained" Grid.Row="1" KeyboardNavigation.TabIndex="2" KeyboardNavigation.TabNavigation="Local">
<Border x:Name="contentPanel" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{DynamicResource BorderBrush}" Background="{TemplateBinding Background}" Grid.Column="0" KeyboardNavigation.DirectionalNavigation="Contained" Grid.Row="1" KeyboardNavigation.TabIndex="2" KeyboardNavigation.TabNavigation="Local">
<ContentPresenter x:Name="PART_SelectedContentHost" ContentSource="SelectedContent" Margin="0" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
</Border>
</Grid>
@@ -13818,7 +13933,6 @@
<Setter TargetName="RowDefinition1" Property="Height" Value="Auto" />
<Setter TargetName="headerPanel" Property="Grid.Row" Value="1" />
<Setter TargetName="contentPanel" Property="Grid.Row" Value="0" />
<Setter TargetName="contentPanel" Property="BorderThickness" Value="{Binding BorderThickness,RelativeSource={RelativeSource TemplatedParent},Converter={StaticResource ThicknessSplitConverter},ConverterParameter='0,0,0,1'}" />
</Trigger>
<Trigger Property="TabStripPlacement" Value="Left">
<Setter TargetName="RowDefinition0" Property="Height" Value="*" />
@@ -13827,7 +13941,6 @@
<Setter TargetName="ColumnDefinition1" Property="Width" Value="*" />
<Setter TargetName="contentPanel" Property="Grid.Column" Value="1" />
<Setter TargetName="contentPanel" Property="Grid.Row" Value="0" />
<Setter TargetName="contentPanel" Property="BorderThickness" Value="{Binding BorderThickness,RelativeSource={RelativeSource TemplatedParent},Converter={StaticResource ThicknessSplitConverter},ConverterParameter='1,0,0,0'}" />
<Setter TargetName="headerPanel" Property="Grid.Column" Value="0" />
<Setter TargetName="headerPanel" Property="Grid.Row" Value="0" />
<Setter TargetName="headerPanel" Property="Rows" Value="0" />
@@ -13840,7 +13953,6 @@
<Setter TargetName="ColumnDefinition1" Property="Width" Value="Auto" />
<Setter TargetName="contentPanel" Property="Grid.Column" Value="0" />
<Setter TargetName="contentPanel" Property="Grid.Row" Value="0" />
<Setter TargetName="contentPanel" Property="BorderThickness" Value="{Binding BorderThickness,RelativeSource={RelativeSource TemplatedParent},Converter={StaticResource ThicknessSplitConverter},ConverterParameter='0,0,1,0'}" />
<Setter TargetName="headerPanel" Property="Grid.Column" Value="1" />
<Setter TargetName="headerPanel" Property="Grid.Row" Value="0" />
<Setter TargetName="headerPanel" Property="Rows" Value="0" />