This repository has been archived on 2024-01-02. You can view files and clone it, but cannot push or open issues or pull requests.
Sic06/FrameworkLocal/UICore/Style/TabControlStyle.xaml

339 lines
17 KiB
Plaintext
Raw Normal View History

2023-01-13 10:57:37 +08:00
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<!-- 通用TabControl样式 -->
<Style x:Key="LargeTab" TargetType="{x:Type TabControl}">
<!--<Setter Property="Background" Value="#FFC5D0D8"/>-->
<Setter Property="Background" Value="#669ACC" />
<Setter Property="FontFamily" Value="Arial,SimSun" />
</Style>
<!-- 通用TabItem样式 -->
<Style TargetType="TabItem">
<Setter Property="FrameworkElement.FocusVisualStyle">
<Setter.Value>
<Style TargetType="Control">
<Style.Resources>
<ResourceDictionary />
</Style.Resources>
<Setter Property="Control.Template">
<Setter.Value>
<ControlTemplate>
<Border>
<Rectangle StrokeThickness="0" />
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Setter.Value>
</Setter>
</Style>
<!-- 通用TabControl样式 -->
<Style TargetType="{x:Type TabControl}">
<!--<Setter Property="Background" Value="#FFC5D0D8"/>-->
<Setter Property="Background" Value="#669ACC" />
<Setter Property="FontFamily" Value="Arial,SimSun" />
<Setter Property="FontSize" Value="17" />
<Setter Property="ItemContainerStyle">
<Setter.Value>
<Style>
<Setter Property="Control.Height" Value="24" />
<Setter Property="Control.Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type TabItem}">
<Grid Margin="0,0,-10,0">
<Path
Data="M190 0 L 0 0 L 10 23 L 170 23 L 190 0"
Fill="{TemplateBinding Background}"
Stroke="Black"
StrokeThickness="1" />
<ContentPresenter
Margin="10,3,10,0"
ContentSource="Header"
Cursor="Hand" />
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsSelected" Value="True">
<Trigger.Setters>
<Setter Property="Background" Value="#FFCBD8D8" />
<Setter Property="Panel.ZIndex" Value="1" />
</Trigger.Setters>
</Trigger>
<Trigger Property="IsSelected" Value="False">
<Trigger.Setters>
<Setter Property="Background" Value="#FFcbd8d8" />
</Trigger.Setters>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Setter.Value>
</Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type TabControl}">
<Grid
ClipToBounds="True"
KeyboardNavigation.TabNavigation="Local"
SnapsToDevicePixels="True">
<Grid.ColumnDefinitions>
<ColumnDefinition Name="ColumnDefinition0" Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Name="RowDefinition0" />
<RowDefinition Name="RowDefinition1" Height="25" />
</Grid.RowDefinitions>
<StackPanel
Name="HeaderPanel"
Grid.Row="1"
Margin="0,0,0,0"
Panel.ZIndex="1"
Background="#2c4746"
IsItemsHost="True"
KeyboardNavigation.TabIndex="1"
Orientation="Horizontal" />
<Border
Name="ContentPanel"
Grid.Row="0"
Background="{TemplateBinding Panel.Background}"
BorderBrush="{TemplateBinding Border.BorderBrush}"
BorderThickness="{TemplateBinding Border.BorderThickness}"
KeyboardNavigation.DirectionalNavigation="Contained"
KeyboardNavigation.TabIndex="2"
KeyboardNavigation.TabNavigation="Local">
<ContentPresenter
Name="PART_SelectedContentHost"
Margin="{TemplateBinding Control.Padding}"
Content="{TemplateBinding TabControl.SelectedContent}"
ContentSource="SelectedContent"
ContentStringFormat="{TemplateBinding TabControl.SelectedContentStringFormat}"
ContentTemplate="{TemplateBinding TabControl.SelectedContentTemplate}"
SnapsToDevicePixels="{TemplateBinding UIElement.SnapsToDevicePixels}" />
</Border>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- 设置TabControl模版样式 -->
<ControlTemplate x:Key="TabStackPanelControlTemplate" TargetType="{x:Type TabControl}">
<Grid
ClipToBounds="True"
KeyboardNavigation.TabNavigation="Local"
SnapsToDevicePixels="True">
<Grid.ColumnDefinitions>
<ColumnDefinition Name="ColumnDefinition0" Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Name="RowDefinition0" />
<RowDefinition Name="RowDefinition1" Height="25" />
</Grid.RowDefinitions>
<StackPanel
Name="HeaderPanel"
Grid.Row="1"
Margin="0,0,0,0"
Panel.ZIndex="1"
Background="#2c4746"
IsItemsHost="True"
KeyboardNavigation.TabIndex="1"
Orientation="Horizontal" />
<Border
Name="ContentPanel"
Grid.Row="0"
BorderBrush="{TemplateBinding Border.BorderBrush}"
BorderThickness="{TemplateBinding Border.BorderThickness}"
KeyboardNavigation.DirectionalNavigation="Contained"
KeyboardNavigation.TabIndex="2"
KeyboardNavigation.TabNavigation="Local">
<ContentPresenter
Name="PART_SelectedContentHost"
Margin="{TemplateBinding Control.Padding}"
Content="{TemplateBinding TabControl.SelectedContent}"
ContentSource="SelectedContent"
ContentStringFormat="{TemplateBinding TabControl.SelectedContentStringFormat}"
ContentTemplate="{TemplateBinding TabControl.SelectedContentTemplate}"
SnapsToDevicePixels="{TemplateBinding UIElement.SnapsToDevicePixels}" />
</Border>
</Grid>
</ControlTemplate>
<!-- SmartProcess -->
<Style x:Key="TabItemSmartProcess" TargetType="{x:Type TabItem}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type TabItem}">
<Grid>
<Border
Name="Border"
Background="#FFC2E4F6"
BorderBrush="Gray"
BorderThickness="1,1,1,1"
CornerRadius="6,6,0,0">
<ContentPresenter
x:Name="ContentSite"
Margin="12,2,12,2"
HorizontalAlignment="Center"
VerticalAlignment="Center"
ContentSource="Header" />
</Border>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter TargetName="Border" Property="Background" Value="#FFC2E4F6" />
</Trigger>
<Trigger Property="IsSelected" Value="False">
<Setter TargetName="Border" Property="Background" Value="Transparent" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- 设置选项卡大小 -->
<Style x:Key="ChromeLargeTab" TargetType="{x:Type TabControl}">
<Setter Property="Background" Value="#FFC5D0D8" />
<Setter Property="FontSize" Value="17" />
<Setter Property="ItemContainerStyle">
<Setter.Value>
<Style>
<Setter Property="Control.Height" Value="24" />
<Setter Property="Control.Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type TabItem}">
<!-- "M60 0 L 0 0 L 10 23 L 45 23 L 60 0" -->
<Grid Margin="0,0,-10,0">
<Path
Data="M120 0 L 0 0 L 10 23 L 90 23 L 120 0"
Fill="{TemplateBinding Background}"
Stroke="Black"
StrokeThickness="1" />
<ContentPresenter
Margin="10,3,10,0"
ContentSource="Header"
Cursor="Hand" />
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsSelected" Value="True">
<Trigger.Setters>
<Setter Property="Background" Value="#FFCBD8D8" />
<Setter Property="Panel.ZIndex" Value="1" />
</Trigger.Setters>
</Trigger>
<Trigger Property="IsSelected" Value="False">
<Trigger.Setters>
<Setter Property="Background" Value="#FFA7ADAD" />
</Trigger.Setters>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="ChromeTabSmall" TargetType="{x:Type TabControl}">
<Setter Property="Background" Value="#FFC5D0D8" />
<Setter Property="FontSize" Value="17" />
<Setter Property="ItemContainerStyle">
<Setter.Value>
<Style>
<Setter Property="Control.Height" Value="24" />
<Setter Property="Control.Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type TabItem}">
<Grid Margin="0,0,-10,0">
<Path
Data="M60 0 L 0 0 L 10 23 L 45 23 L 60 0"
Fill="{TemplateBinding Background}"
Stroke="Black"
StrokeThickness="1" />
<ContentPresenter
Margin="8,3,7,0"
ContentSource="Header"
Cursor="Hand" />
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsSelected" Value="True">
<Trigger.Setters>
<Setter Property="Background" Value="#FFCBD8D8" />
<Setter Property="Panel.ZIndex" Value="1" />
</Trigger.Setters>
</Trigger>
<Trigger Property="IsSelected" Value="False">
<Trigger.Setters>
<Setter Property="Background" Value="#FFA7ADAD" />
</Trigger.Setters>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="Main_TabItem" TargetType="{x:Type TabItem}">
<Setter Property="SnapsToDevicePixels" Value="True" />
<Setter Property="FocusVisualStyle" Value="{StaticResource TabItemFocusVisual}" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="Foreground" Value="{DynamicResource SubMenu_FG}" />
<Setter Property="FontFamily" Value="Arial" />
<Setter Property="MinWidth" Value="100" />
<Setter Property="Height" Value="25" />
<Setter Property="FontSize" Value="14" />
<!--<Setter Property="FontWeight" Value="bold"/>-->
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type TabItem}">
<Border x:Name="BG" Cursor="Hand">
<Border x:Name="InnerBD" Background="#FFa7adad">
<!--<ContentPresenter x:Name="Content" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" ContentSource="Header" RecognizesAccessKey="True" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="6,0"/>-->
<Grid Margin="0,0,-10,0">
<Path
Data="M190 0 L 0 0 L 10 23 L 170 23 L 190 0"
Fill="{TemplateBinding Background}"
Stroke="Black"
StrokeThickness="1" />
<ContentPresenter
Margin="10,3,10,0"
ContentSource="Header"
Cursor="Hand" />
</Grid>
</Border>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsSelected" Value="True">
<Trigger.Setters>
<Setter TargetName="InnerBD" Property="Background" Value="#FF2c4746" />
<Setter Property="Background" Value="#FFCBD8D8" />
<Setter Property="Panel.ZIndex" Value="1" />
</Trigger.Setters>
</Trigger>
<Trigger Property="IsSelected" Value="False">
<Trigger.Setters>
<Setter TargetName="InnerBD" Property="Background" Value="#FF2c4746" />
<Setter Property="Background" Value="#FFA7ADAD" />
</Trigger.Setters>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>