20241106_MiLu_upperpc/DeerProject/Assets/Styles/TabControlStyles.xaml

270 lines
15 KiB
Plaintext
Raw Permalink Normal View History

2025-02-20 05:54:12 +00:00
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Style TargetType="TabItem" x:Key="FlowTabStyle">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Foreground" Value="#1f71e5"/>
<Setter Property="FontSize" Value="12"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="TabItem">
<Grid Background="{TemplateBinding Background}" Height="26">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto"/>
<ColumnDefinition/>
<ColumnDefinition Width="auto"/>
</Grid.ColumnDefinitions>
<Grid.InputBindings>
<MouseBinding MouseAction="LeftDoubleClick"
Command="{Binding EditTitleCommand}"/>
</Grid.InputBindings>
<TextBlock Text="&#xe610;"
FontFamily="{DynamicResource Iconfont}"
VerticalAlignment="Center"
Margin="5,0"/>
<ContentPresenter ContentSource="Header"
VerticalAlignment="Center"
Grid.Column="1"
Margin="3,0,0,0"
x:Name="header"/>
<TextBox Grid.Column="1"
Text="{Binding Title}"
Name="m_header"
Visibility="{Binding TitleEditVisible}"
VerticalContentAlignment="Center"
Background="#DFFF"
BorderThickness="0"
Foreground="#1f71e5"
Margin="0,2">
<TextBox.InputBindings>
<KeyBinding Key="Return"
Command="{Binding AcceptTitleCommand}"/>
</TextBox.InputBindings>
</TextBox>
<Button Content="&#xe660;" FontFamily="{DynamicResource Iconfont}"
Grid.Column="2" FontSize="10" Style="{x:Null}"
Visibility="Hidden"
Width="20" Height="20" Margin="5,0" Name="button"
Command="{Binding DataContext.CloseFlowTabCommand,RelativeSource={RelativeSource AncestorType=Window}}"
CommandParameter="{Binding}">
<Button.Template>
<ControlTemplate TargetType="Button">
<Border Background="Transparent" Name="border">
<ContentPresenter VerticalAlignment="Center"
HorizontalAlignment="Center"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="border" Property="Background"
Value="#2000"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Button.Template>
</Button>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="#1000"/>
<Setter TargetName="button" Property="Visibility" Value="Visible"/>
</Trigger>
<Trigger Property="IsSelected" Value="True">
<Setter Property="Background" Value="#1f71e5"/>
<Setter Property="Foreground" Value="White"/>
<Setter TargetName="button" Property="Visibility" Value="Visible"/>
<Setter TargetName="button" Property="Foreground" Value="white"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="ToggleButton" x:Key="TabListButtonStyle">
<Setter Property="Foreground" Value="#888"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ToggleButton">
<Border Background="{TemplateBinding Background}">
<ContentPresenter VerticalAlignment="Center" HorizontalAlignment="Center"/>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="#1000"/>
</Trigger>
<Trigger Property="IsChecked" Value="True">
<Setter Property="Background" Value="#1000"/>
</Trigger>
</Style.Triggers>
</Style>
<Style TargetType="Button" x:Key="TabListItemButtonStyle">
<Setter Property="FontSize" Value="12"/>
<Setter Property="Margin" Value="3,2"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border Height="30" Background="Transparent" Name="border" CornerRadius="5">
<ContentPresenter VerticalAlignment="Center" HorizontalAlignment="Left"
Margin="15,0,0,0"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="border" Property="Background" Value="#1000"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="RepeatButton">
<Setter Property="Foreground" Value="#888"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="RepeatButton">
<Border Background="{TemplateBinding Background}" Margin="0,-3">
<ContentPresenter VerticalAlignment="Center" HorizontalAlignment="Center"/>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="#1000"/>
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Foreground" Value="#CCC"/>
</Trigger>
</Style.Triggers>
</Style>
<Style TargetType="ScrollBar" x:Key="TabScrollBarStyle">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ScrollBar">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="20"/>
<ColumnDefinition Width="20"/>
</Grid.ColumnDefinitions>
<RepeatButton FontFamily="{DynamicResource Iconfont}"
Command="ScrollBar.LineLeftCommand"
Content="&#xe603;" />
<RepeatButton FontFamily="{DynamicResource Iconfont}"
Grid.Column="1"
Command="ScrollBar.LineRightCommand"
Content="&#xe602;" />
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="ScrollViewer" x:Key="TabScrollViewerStyle">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ScrollViewer">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition Width="44"/>
</Grid.ColumnDefinitions>
<Border Width="1" Height="14" Background="#BBB" HorizontalAlignment="Right"/>
<ScrollBar x:Name="PART_HorizontalScrollBar"
Orientation="Horizontal"
Grid.ColumnSpan="2"
Value="{TemplateBinding HorizontalOffset}"
Maximum="{TemplateBinding ScrollableWidth}"
ViewportSize="{TemplateBinding ViewportWidth}"
Grid.Column="1"
Style="{StaticResource TabScrollBarStyle}"
Margin="3,-3" Background="Red"/>
<ScrollContentPresenter CanContentScroll="{TemplateBinding CanContentScroll}"
Margin="5,0"/>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="TabControlStyle" TargetType="{x:Type TabControl}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type TabControl}">
<Grid x:Name="templateRoot" ClipToBounds="true" SnapsToDevicePixels="true"
KeyboardNavigation.TabNavigation="Local">
<Grid.RowDefinitions>
<RowDefinition Height="26"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition Width="28"/>
</Grid.ColumnDefinitions>
<ScrollViewer VerticalScrollBarVisibility="Disabled"
HorizontalScrollBarVisibility="Visible"
Style="{StaticResource TabScrollViewerStyle}">
<TabPanel x:Name="headerPanel" Background="Transparent"
IsItemsHost="true" Margin="2,2,2,0"
KeyboardNavigation.TabIndex="1" Panel.ZIndex="1"/>
</ScrollViewer>
<ToggleButton Grid.Column="1" Name="tb_tabs"
Style="{StaticResource TabListButtonStyle}"
Content="&#xe600;"
FontFamily="{DynamicResource Iconfont}"/>
<Border x:Name="contentPanel" Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
Grid.ColumnSpan="2" KeyboardNavigation.DirectionalNavigation="Contained"
Grid.Row="1" KeyboardNavigation.TabIndex="2"
KeyboardNavigation.TabNavigation="Local">
<ContentPresenter x:Name="PART_SelectedContentHost"
ContentSource="SelectedContent"
Margin="{TemplateBinding Padding}"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
</Border>
<Popup StaysOpen="False" IsOpen="{Binding ElementName=tb_tabs,Path=IsChecked}"
PlacementTarget="{Binding ElementName=tb_tabs}"
AllowsTransparency="True"
HorizontalOffset="-130"
VerticalOffset="3">
<Border Width="160" CornerRadius="5" Background="White"
Margin="3">
<Border.Effect>
<DropShadowEffect BlurRadius="5" ShadowDepth="0" Opacity="0.3" Color="Gray"/>
</Border.Effect>
<StackPanel Margin="0,3">
<Button Content="关闭当前流程" Style="{StaticResource TabListItemButtonStyle}"
Command="{Binding CloseFlowTabCommand}"
CommandParameter="1"/>
<Button Content="关闭其他流程" Style="{StaticResource TabListItemButtonStyle}"
Command="{Binding CloseFlowTabCommand}"
CommandParameter="2"/>
<Border Height="1" Background="#DDD"/>
<ItemsControl ItemsSource="{Binding FlowTabList}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Button Content="{Binding Title}"
Style="{StaticResource TabListItemButtonStyle}"
Command="{Binding SelectCommand}"/>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</StackPanel>
</Border>
</Popup>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>