livia-test/Livia/Resources/Themes/MainWindowTabButton.xaml
2025-03-28 14:31:53 +08:00

133 lines
6.7 KiB
XML

<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:attachedProperties="clr-namespace:Livia.Views.AttachedProperties"
xmlns:converters="clr-namespace:Livia.Views.Converters">
<Style TargetType="{x:Type RadioButton}"
x:Key="MainWindowTabRadioButton">
<Style.Resources>
<converters:StringToFontFamilyConverter x:Key="StringToFontFamilyConverter" />
</Style.Resources>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="RadioButton">
<Border Width="144"
Height="40"
Name="Border"
Background="Transparent"
CornerRadius="0,20,20,0">
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(attachedProperties:StringItemProperties.ItemName)}"
Name="ButtonText"
Margin="2"
Padding="20,4,0,4"
VerticalAlignment="Center"
HorizontalAlignment="Left"
Foreground="{StaticResource PrimaryTextColorBrush}"
Style="{StaticResource MaterialDesignBody2TextBlock}" />
<Button Margin="-8, 2, 0, 0"
ToolTip="{StaticResource AslLabelTip}"
Style="{StaticResource LiviaPrimaryIconButton}"
attachedProperties:IconKindProperties.IconKind="HelpCircleOutline"
Visibility="{Binding (attachedProperties:MaterialTitleBarButtonProperties.IconSwitch), RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource BooleanToVisibilityConverter}}"/>
</StackPanel>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsChecked"
Value="True">
<Setter TargetName="Border"
Property="Background"
Value="{StaticResource PrimaryColorHighlightBrush}" />
<Setter TargetName="ButtonText"
Property="Foreground"
Value="{StaticResource White1Brush}" />
</Trigger>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsMouseOver"
Value="True" />
<Condition Property="IsChecked"
Value="False" />
</MultiTrigger.Conditions>
<Setter TargetName="Border"
Property="Background"
Value="{StaticResource PrimaryColorLightBrush}" />
<Setter TargetName="ButtonText"
Property="Foreground"
Value="{StaticResource White1Brush}" />
</MultiTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="{x:Type RadioButton}"
x:Key="LiviaTabRadioButton">
<Style.Resources>
<converters:StringToFontFamilyConverter x:Key="StringToFontFamilyConverter" />
</Style.Resources>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="RadioButton">
<Border Width="80"
Height="28"
Name="Border"
BorderBrush="{StaticResource PrimaryTextColorBrush}"
BorderThickness="1"
Background="Transparent">
<TextBlock Text="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Content}"
Name="ButtonText"
Margin="0,0,0,3"
VerticalAlignment="Center"
HorizontalAlignment="Center"
Foreground="{StaticResource PrimaryTextColorBrush}"
Style="{StaticResource MaterialDesignBody2TextBlock}" />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsChecked"
Value="True">
<Setter TargetName="Border"
Property="Background"
Value="{StaticResource PrimaryColorHighlightBrush}" />
<Setter TargetName="Border"
Property="BorderThickness"
Value="0" />
<Setter TargetName="Border"
Property="Height"
Value="29" />
<Setter TargetName="ButtonText"
Property="Foreground"
Value="{StaticResource White1Brush}" />
</Trigger>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsMouseOver"
Value="True" />
<Condition Property="IsChecked"
Value="False" />
</MultiTrigger.Conditions>
<Setter TargetName="Border"
Property="Background"
Value="{StaticResource PrimaryColorLightBrush}" />
<Setter TargetName="ButtonText"
Property="Foreground"
Value="{StaticResource White1Brush}" />
</MultiTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>