<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:XFEToolBox.WpfCore.Controls">
<BooleanToVisibilityConverter x:Key="TimePickerBooleanToVisibilityConverter"/>
<!-- 统一进度控件。 -->
<Style x:Key="UnifiedProgressBarStyle" TargetType="ProgressBar">
<Setter Property="Height" Value="8"/>
<Setter Property="MinWidth" Value="80"/>
<Setter Property="Foreground" Value="{DynamicResource MainColor}"/>
<Setter Property="Background" Value="{DynamicResource ToolAccentSoftBrush}"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ProgressBar">
<controls:RoundedClipBorder Background="{TemplateBinding Background}" CornerRadius="4">
<Grid x:Name="PART_Track" ClipToBounds="True">
<Border x:Name="PART_Indicator" HorizontalAlignment="Left"
Background="{TemplateBinding Foreground}" CornerRadius="4"/>
<Border x:Name="IndeterminateBar" Width="56" HorizontalAlignment="Left"
Background="{TemplateBinding Foreground}" CornerRadius="4" Visibility="Collapsed">
<Border.RenderTransform>
<TranslateTransform x:Name="IndeterminateTransform" X="-70"/>
</Border.RenderTransform>
</Border>
</Grid>
</controls:RoundedClipBorder>
<ControlTemplate.Triggers>
<Trigger Property="IsIndeterminate" Value="True">
<Setter TargetName="PART_Indicator" Property="Visibility" Value="Collapsed"/>
<Setter TargetName="IndeterminateBar" Property="Visibility" Value="Visible"/>
<Trigger.EnterActions>
<BeginStoryboard x:Name="IndeterminateStoryboard">
<Storyboard>
<DoubleAnimation Storyboard.TargetName="IndeterminateTransform"
Storyboard.TargetProperty="X" From="-70" To="420"
Duration="0:0:1.35" RepeatBehavior="Forever"/>
</Storyboard>
</BeginStoryboard>
</Trigger.EnterActions>
<Trigger.ExitActions>
<StopStoryboard BeginStoryboardName="IndeterminateStoryboard"/>
</Trigger.ExitActions>
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Opacity" Value="0.48"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="ProgressBar" BasedOn="{StaticResource UnifiedProgressBarStyle}"/>
<Style TargetType="controls:ProgressRing">
<Setter Property="Width" Value="32"/>
<Setter Property="Height" Value="32"/>
<Setter Property="Foreground" Value="{DynamicResource MainColor}"/>
<Setter Property="Background" Value="{DynamicResource ToolAccentSoftBrush}"/>
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="controls:ProgressRing">
<Border Background="Transparent"/>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Opacity" Value="0.25"/>
</Trigger>
</Style.Triggers>
</Style>
<!-- CommandBar:主命令位于中间,Header 和 SecondaryContent 可选。 -->
<Style TargetType="controls:CommandBar">
<Setter Property="MinHeight" Value="52"/>
<Setter Property="Padding" Value="10,8"/>
<Setter Property="Background" Value="{DynamicResource ToolSurfaceBrush}"/>
<Setter Property="BorderBrush" Value="{DynamicResource ToolControlBorderBrush}"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="Foreground" Value="{DynamicResource ToolTextPrimaryBrush}"/>
<Setter Property="ItemsPanel">
<Setter.Value>
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal" VerticalAlignment="Center"/>
</ItemsPanelTemplate>
</Setter.Value>
</Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="controls:CommandBar">
<Border x:Name="Surface" Padding="{TemplateBinding Padding}"
Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="15">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<ContentPresenter x:Name="HeaderPresenter" ContentSource="Header"
Margin="4,0,14,0" VerticalAlignment="Center"
TextElement.FontWeight="SemiBold"/>
<ItemsPresenter Grid.Column="1" VerticalAlignment="Center"/>
<ContentPresenter x:Name="SecondaryPresenter" Grid.Column="2"
Content="{TemplateBinding SecondaryContent}"
Margin="14,0,2,0" VerticalAlignment="Center"/>
</Grid>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="Header" Value="{x:Null}">
<Setter TargetName="HeaderPresenter" Property="Visibility" Value="Collapsed"/>
</Trigger>
<Trigger Property="SecondaryContent" Value="{x:Null}">
<Setter TargetName="SecondaryPresenter" Property="Visibility" Value="Collapsed"/>
</Trigger>
<Trigger Property="IsCompact" Value="True">
<Setter Property="MinHeight" Value="42"/>
<Setter Property="Padding" Value="7,5"/>
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter TargetName="Surface" Property="Opacity" Value="0.55"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- AutoSuggestBox。 -->
<Style x:Key="AutoSuggestBoxItemStyle" TargetType="ComboBoxItem">
<Setter Property="MinHeight" Value="34"/>
<Setter Property="Padding" Value="11,8"/>
<Setter Property="Margin" Value="0,1"/>
<Setter Property="Foreground" Value="{DynamicResource ToolTextPrimaryBrush}"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
<Setter Property="Cursor" Value="Hand"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ComboBoxItem">
<Border x:Name="SuggestionSurface" Padding="{TemplateBinding Padding}"
Background="{TemplateBinding Background}" CornerRadius="9">
<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="Center"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsHighlighted" Value="True">
<Setter TargetName="SuggestionSurface" Property="Background" Value="{DynamicResource ToolControlHoverBrush}"/>
</Trigger>
<Trigger Property="IsSelected" Value="True">
<Setter TargetName="SuggestionSurface" Property="Background" Value="{DynamicResource ToolAccentSelectedBrush}"/>
<Setter Property="Foreground" Value="{DynamicResource MainColor}"/>
</Trigger>
<Trigger Property="IsEnabled" Value="False"><Setter Property="Opacity" Value="0.45"/></Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="controls:AutoSuggestBox">
<Setter Property="MinHeight" Value="38"/>
<Setter Property="Padding" Value="36,0,34,0"/>
<Setter Property="Foreground" Value="{DynamicResource ToolTextPrimaryBrush}"/>
<Setter Property="Background" Value="{DynamicResource ToolControlBackgroundBrush}"/>
<Setter Property="BorderBrush" Value="{DynamicResource ToolControlBorderBrush}"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="ItemContainerStyle" Value="{StaticResource AutoSuggestBoxItemStyle}"/>
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="controls:AutoSuggestBox">
<Grid x:Name="Root">
<Border x:Name="Surface" Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="11">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="36"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="32"/>
</Grid.ColumnDefinitions>
<Path Width="14" Height="14" Data="M 7,1 A 6,6 0 1 1 7,13 A 6,6 0 1 1 7,1 M 11.3,11.3 L 15,15"
Stretch="Uniform" Stroke="{DynamicResource MainColor}" StrokeThickness="1.7"
StrokeStartLineCap="Round" StrokeEndLineCap="Round"/>
<Grid Grid.Column="1" Margin="0,2">
<TextBox x:Name="PART_EditableTextBox" Style="{x:Null}" Background="Transparent"
BorderThickness="0" Foreground="{TemplateBinding Foreground}"
CaretBrush="{DynamicResource MainColor}"
SelectionBrush="{DynamicResource MainColor}"
FocusVisualStyle="{x:Null}"
VerticalContentAlignment="Center"/>
<TextBlock x:Name="Placeholder" Text="{TemplateBinding PlaceholderText}" Visibility="Collapsed"
Foreground="{DynamicResource ToolTextDisabledBrush}"
VerticalAlignment="Center" IsHitTestVisible="False"/>
</Grid>
<ToggleButton Grid.Column="2" Style="{x:Null}" Focusable="False"
IsChecked="{Binding IsDropDownOpen, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}">
<ToggleButton.Template>
<ControlTemplate TargetType="ToggleButton">
<Grid Background="Transparent">
<Path x:Name="Arrow" Width="8" Height="5" Data="M 0,0 L 4,4 L 8,0 Z"
Stretch="Fill" Fill="{DynamicResource MainColor}"
HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsChecked" Value="True">
<Setter TargetName="Arrow" Property="RenderTransformOrigin" Value="0.5,0.5"/>
<Setter TargetName="Arrow" Property="RenderTransform">
<Setter.Value><RotateTransform Angle="180"/></Setter.Value>
</Setter>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</ToggleButton.Template>
</ToggleButton>
</Grid>
</Border>
<Popup x:Name="PART_Popup" Placement="Bottom" IsOpen="{TemplateBinding IsDropDownOpen}"
AllowsTransparency="True" Focusable="False" PopupAnimation="Fade">
<Border MinWidth="{Binding ActualWidth, ElementName=Root}" Margin="0,6,0,0" Padding="5"
Background="{DynamicResource ToolSurfaceBrush}"
BorderBrush="{DynamicResource ToolControlBorderBrush}" BorderThickness="1" CornerRadius="12">
<Border.Effect>
<DropShadowEffect Color="#514D74" BlurRadius="20" ShadowDepth="5" Opacity="0.18"/>
</Border.Effect>
<ScrollViewer MaxHeight="248" HorizontalScrollBarVisibility="Disabled"
VerticalScrollBarVisibility="Auto">
<ItemsPresenter KeyboardNavigation.DirectionalNavigation="Contained"/>
</ScrollViewer>
</Border>
</Popup>
</Grid>
<ControlTemplate.Triggers>
<Trigger SourceName="PART_EditableTextBox" Property="Text" Value="">
<Setter TargetName="Placeholder" Property="Visibility" Value="Visible"/>
</Trigger>
<Trigger SourceName="PART_EditableTextBox" Property="Text" Value="{x:Null}">
<Setter TargetName="Placeholder" Property="Visibility" Value="Visible"/>
</Trigger>
<Trigger Property="IsKeyboardFocusWithin" Value="True">
<Setter TargetName="Surface" Property="BorderBrush" Value="{DynamicResource MainColor}"/>
<Setter TargetName="Surface" Property="BorderThickness" Value="1.5"/>
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="Surface" Property="BorderBrush" Value="{DynamicResource ToolControlHoverBorderBrush}"/>
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Opacity" Value="0.55"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- InfoBar。 -->
<Style TargetType="controls:InfoBar">
<Setter Property="Padding" Value="14,12"/>
<Setter Property="Background" Value="#F1F1FC"/>
<Setter Property="BorderBrush" Value="#DADAEE"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="Foreground" Value="{DynamicResource ToolTextPrimaryBrush}"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="controls:InfoBar">
<Border x:Name="InfoSurface" Padding="{TemplateBinding Padding}"
Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="13">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="28"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Border x:Name="IconSurface" Width="22" Height="22" HorizontalAlignment="Left"
VerticalAlignment="Top" Background="{DynamicResource MainColor}" CornerRadius="11">
<TextBlock x:Name="SeverityIcon" Text="i" Foreground="White" FontWeight="Bold"
HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
<StackPanel Grid.Column="1" Margin="2,0,12,0">
<TextBlock x:Name="TitlePresenter" Text="{TemplateBinding Title}"
FontSize="12" FontWeight="SemiBold" TextWrapping="Wrap"/>
<TextBlock x:Name="MessagePresenter" Text="{TemplateBinding Message}"
Margin="0,3,0,0" Foreground="{DynamicResource ToolTextSecondaryBrush}"
FontSize="10.5" TextWrapping="Wrap"/>
<ContentPresenter Content="{TemplateBinding Content}" Margin="0,8,0,0"/>
</StackPanel>
<ContentPresenter x:Name="ActionPresenter" Grid.Column="2"
Content="{TemplateBinding ActionContent}" Margin="8,0"
VerticalAlignment="Center"/>
<Button x:Name="PART_CloseButton" Grid.Column="3" Width="28" Height="28" MinWidth="0"
Padding="0" Margin="5,-4,-5,-4" ToolTip="关闭" Style="{x:Null}">
<Button.Template>
<ControlTemplate TargetType="Button">
<Border x:Name="CloseSurface" Background="Transparent" CornerRadius="8">
<Path Width="10" Height="10" Data="M 1,1 L 9,9 M 9,1 L 1,9"
Stretch="Fill" Stroke="{DynamicResource ToolTextSecondaryBrush}"
StrokeThickness="1.5" StrokeStartLineCap="Round" StrokeEndLineCap="Round"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="CloseSurface" Property="Background" Value="#18000000"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Button.Template>
</Button>
</Grid>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsOpen" Value="False">
<Setter Property="Visibility" Value="Collapsed"/>
</Trigger>
<Trigger Property="IsClosable" Value="False">
<Setter TargetName="PART_CloseButton" Property="Visibility" Value="Collapsed"/>
</Trigger>
<Trigger Property="Title" Value="">
<Setter TargetName="TitlePresenter" Property="Visibility" Value="Collapsed"/>
<Setter TargetName="MessagePresenter" Property="Margin" Value="0"/>
</Trigger>
<Trigger Property="Content" Value="{x:Null}">
<Setter TargetName="ActionPresenter" Property="VerticalAlignment" Value="Center"/>
</Trigger>
<Trigger Property="Severity" Value="Success">
<Setter TargetName="InfoSurface" Property="Background" Value="#EFF9F3"/>
<Setter TargetName="InfoSurface" Property="BorderBrush" Value="#CDE9D7"/>
<Setter TargetName="IconSurface" Property="Background" Value="#55A978"/>
<Setter TargetName="SeverityIcon" Property="Text" Value="✓"/>
</Trigger>
<Trigger Property="Severity" Value="Warning">
<Setter TargetName="InfoSurface" Property="Background" Value="#FFF8EA"/>
<Setter TargetName="InfoSurface" Property="BorderBrush" Value="#F1DCA8"/>
<Setter TargetName="IconSurface" Property="Background" Value="#D69A34"/>
<Setter TargetName="SeverityIcon" Property="Text" Value="!"/>
</Trigger>
<Trigger Property="Severity" Value="Error">
<Setter TargetName="InfoSurface" Property="Background" Value="#FFF1F3"/>
<Setter TargetName="InfoSurface" Property="BorderBrush" Value="#F0CDD3"/>
<Setter TargetName="IconSurface" Property="Background" Value="{DynamicResource ToolDangerBrush}"/>
<Setter TargetName="SeverityIcon" Property="Text" Value="×"/>
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter TargetName="InfoSurface" Property="Opacity" Value="0.55"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- 统一头像;没有图片时自动展示姓名首字。 -->
<Style TargetType="controls:PersonPicture">
<Setter Property="Width" Value="36"/>
<Setter Property="Height" Value="36"/>
<Setter Property="FontSize" Value="13"/>
<Setter Property="Foreground" Value="White"/>
<Setter Property="Background" Value="{DynamicResource MainColor}"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="controls:PersonPicture">
<Grid>
<Ellipse x:Name="AvatarSurface" Fill="{TemplateBinding Background}"
Stroke="#72FFFFFF" StrokeThickness="1"/>
<TextBlock Text="{TemplateBinding ResolvedInitials}" Foreground="{TemplateBinding Foreground}"
FontWeight="Bold" FontSize="{TemplateBinding FontSize}"
HorizontalAlignment="Center" VerticalAlignment="Center"/>
<Ellipse x:Name="Photo" Stroke="#72FFFFFF" StrokeThickness="1">
<Ellipse.Fill>
<ImageBrush ImageSource="{TemplateBinding ProfilePicture}" Stretch="UniformToFill"/>
</Ellipse.Fill>
</Ellipse>
<Ellipse x:Name="OnlineBadge" Width="10" Height="10" HorizontalAlignment="Right"
VerticalAlignment="Bottom" Fill="#54D88B" Stroke="White" StrokeThickness="2"
Visibility="Collapsed"/>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="ProfilePicture" Value="{x:Null}">
<Setter TargetName="Photo" Property="Visibility" Value="Collapsed"/>
</Trigger>
<Trigger Property="IsOnline" Value="True">
<Setter TargetName="OnlineBadge" Property="Visibility" Value="Visible"/>
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter TargetName="AvatarSurface" Property="Opacity" Value="0.45"/>
<Setter TargetName="Photo" Property="Opacity" Value="0.45"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- Expander。 -->
<Style x:Key="UnifiedExpanderStyle" TargetType="Expander">
<Setter Property="Foreground" Value="{DynamicResource ToolTextPrimaryBrush}"/>
<Setter Property="Background" Value="{DynamicResource ToolSurfaceBrush}"/>
<Setter Property="BorderBrush" Value="{DynamicResource ToolControlBorderBrush}"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Expander">
<Border x:Name="Surface" Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="13">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<ToggleButton x:Name="HeaderSite" MinHeight="44" Padding="14,8"
Style="{x:Null}" IsChecked="{Binding IsExpanded, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}">
<ToggleButton.Template>
<ControlTemplate TargetType="ToggleButton">
<Border x:Name="HeaderSurface" Background="Transparent" CornerRadius="12">
<Grid Margin="{TemplateBinding Padding}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="24"/>
</Grid.ColumnDefinitions>
<ContentPresenter ContentSource="Content" VerticalAlignment="Center"
TextElement.FontWeight="SemiBold"/>
<Border Grid.Column="1" Width="24" Height="24" CornerRadius="8"
Background="{DynamicResource ToolAccentSoftBrush}">
<Path x:Name="Arrow" Width="7" Height="11" Data="M 1,1 L 6,5.5 L 1,10"
Stretch="Fill" Stroke="{DynamicResource MainColor}" StrokeThickness="1.6"
StrokeStartLineCap="Round" StrokeEndLineCap="Round"/>
</Border>
</Grid>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="HeaderSurface" Property="Background" Value="{DynamicResource ToolControlHoverBrush}"/>
</Trigger>
<Trigger Property="IsChecked" Value="True">
<Setter TargetName="Arrow" Property="RenderTransformOrigin" Value="0.5,0.5"/>
<Setter TargetName="Arrow" Property="RenderTransform">
<Setter.Value><RotateTransform Angle="90"/></Setter.Value>
</Setter>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</ToggleButton.Template>
<ContentPresenter ContentSource="Header"/>
</ToggleButton>
<Border x:Name="ExpandSite" Grid.Row="1" Margin="14,0,14,14" Padding="0,12,0,0"
BorderBrush="{DynamicResource ToolDividerBrush}" BorderThickness="0,1,0,0"
Visibility="Collapsed">
<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
</Border>
</Grid>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsExpanded" Value="True">
<Setter TargetName="ExpandSite" Property="Visibility" Value="Visible"/>
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter TargetName="Surface" Property="Opacity" Value="0.5"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="Expander" BasedOn="{StaticResource UnifiedExpanderStyle}"/>
<!-- Image 默认使用高质量缩放;需要圆角时可使用 UnifiedRoundedImageStyle。 -->
<Style x:Key="UnifiedImageStyle" TargetType="Image">
<Setter Property="Stretch" Value="Uniform"/>
<Setter Property="SnapsToDevicePixels" Value="True"/>
<Setter Property="RenderOptions.BitmapScalingMode" Value="HighQuality"/>
<Setter Property="controls:ControlAssist.CornerRadius" Value="0"/>
</Style>
<Style x:Key="UnifiedRoundedImageStyle" TargetType="Image" BasedOn="{StaticResource UnifiedImageStyle}">
<Setter Property="Stretch" Value="UniformToFill"/>
<Setter Property="controls:ControlAssist.CornerRadius" Value="14"/>
</Style>
<Style TargetType="Image" BasedOn="{StaticResource UnifiedImageStyle}"/>
<!-- RadioButton 和 ToggleButton。 -->
<Style x:Key="UnifiedRadioButtonStyle" TargetType="RadioButton">
<Setter Property="MinHeight" Value="24"/>
<Setter Property="Foreground" Value="{DynamicResource ToolTextPrimaryBrush}"/>
<Setter Property="FontSize" Value="11"/>
<Setter Property="Cursor" Value="Hand"/>
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="RadioButton">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="24"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Border x:Name="Ring" Width="18" Height="18" HorizontalAlignment="Left"
Background="{DynamicResource ToolControlBackgroundBrush}"
BorderBrush="{DynamicResource ToolControlBorderBrush}"
BorderThickness="1" CornerRadius="9"/>
<Ellipse x:Name="Dot" Width="8" Height="8" HorizontalAlignment="Left" Margin="5,0,0,0"
Fill="{DynamicResource MainColor}" Opacity="0" RenderTransformOrigin="0.5,0.5">
<Ellipse.RenderTransform><ScaleTransform ScaleX="0.5" ScaleY="0.5"/></Ellipse.RenderTransform>
</Ellipse>
<ContentPresenter Grid.Column="1" Margin="3,0,0,0"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="Ring" Property="Background" Value="{DynamicResource ToolAccentSoftBrush}"/>
<Setter TargetName="Ring" Property="BorderBrush" Value="{DynamicResource MainColor}"/>
</Trigger>
<Trigger Property="IsChecked" Value="True">
<Setter TargetName="Ring" Property="BorderBrush" Value="{DynamicResource MainColor}"/>
<Setter TargetName="Ring" Property="BorderThickness" Value="1.5"/>
<Setter TargetName="Dot" Property="Opacity" Value="1"/>
<Setter TargetName="Dot" Property="RenderTransform">
<Setter.Value><ScaleTransform ScaleX="1" ScaleY="1"/></Setter.Value>
</Setter>
</Trigger>
<Trigger Property="IsKeyboardFocused" Value="True">
<Setter TargetName="Ring" Property="BorderBrush" Value="{DynamicResource MainColor}"/>
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Opacity" Value="0.48"/>
<Setter Property="Cursor" Value="Arrow"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="RadioButton" BasedOn="{StaticResource UnifiedRadioButtonStyle}"/>
<Style x:Key="UnifiedToggleButtonStyle" TargetType="ToggleButton">
<Setter Property="Height" Value="36"/>
<Setter Property="MinWidth" Value="66"/>
<Setter Property="Padding" Value="14,0"/>
<Setter Property="Foreground" Value="{DynamicResource ToolTextPrimaryBrush}"/>
<Setter Property="Background" Value="{DynamicResource ToolControlBackgroundBrush}"/>
<Setter Property="BorderBrush" Value="{DynamicResource ToolControlBorderBrush}"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
<Setter Property="Cursor" Value="Hand"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ToggleButton">
<Border x:Name="ToggleSurface" Padding="{TemplateBinding Padding}"
Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="11">
<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="ToggleSurface" Property="Background" Value="{DynamicResource ToolControlHoverBrush}"/>
<Setter TargetName="ToggleSurface" Property="BorderBrush" Value="{DynamicResource ToolControlHoverBorderBrush}"/>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter TargetName="ToggleSurface" Property="Background" Value="{DynamicResource ToolControlPressedBrush}"/>
</Trigger>
<Trigger Property="IsChecked" Value="True">
<Setter TargetName="ToggleSurface" Property="Background" Value="{DynamicResource ToolAccentSelectedBrush}"/>
<Setter TargetName="ToggleSurface" Property="BorderBrush" Value="{DynamicResource MainColor}"/>
<Setter Property="Foreground" Value="{DynamicResource MainColor}"/>
<Setter Property="FontWeight" Value="SemiBold"/>
</Trigger>
<Trigger Property="IsKeyboardFocused" Value="True">
<Setter TargetName="ToggleSurface" Property="BorderBrush" Value="{DynamicResource MainColor}"/>
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Opacity" Value="0.48"/>
<Setter Property="Cursor" Value="Arrow"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="ToggleButton" BasedOn="{StaticResource UnifiedToggleButtonStyle}"/>
<!-- Slider。 -->
<Style x:Key="UnifiedSliderThumbStyle" TargetType="Thumb">
<Setter Property="Width" Value="18"/>
<Setter Property="Height" Value="18"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Thumb">
<Grid>
<Ellipse x:Name="ThumbShadow" Width="18" Height="18" Fill="#22000000" Margin="0,2,0,-2"/>
<Ellipse x:Name="ThumbSurface" Width="18" Height="18" Fill="White"
Stroke="{DynamicResource MainColor}" StrokeThickness="2"/>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="ThumbSurface" Property="Fill" Value="{DynamicResource ToolAccentSoftBrush}"/>
<Setter TargetName="ThumbSurface" Property="StrokeThickness" Value="2.5"/>
</Trigger>
<Trigger Property="IsDragging" Value="True">
<Setter TargetName="ThumbSurface" Property="Fill" Value="{DynamicResource MainColor}"/>
<Setter TargetName="ThumbSurface" Property="Stroke" Value="White"/>
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Opacity" Value="0.45"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<ControlTemplate x:Key="UnifiedHorizontalSliderTemplate" TargetType="Slider">
<Grid Height="24" Background="Transparent">
<Track x:Name="PART_Track" VerticalAlignment="Center">
<Track.DecreaseRepeatButton>
<RepeatButton Command="{x:Static Slider.DecreaseLarge}" CommandTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}"
Height="5" BorderThickness="0" Focusable="False">
<RepeatButton.Template>
<ControlTemplate TargetType="RepeatButton">
<Border Background="{DynamicResource MainColor}" CornerRadius="3"/>
</ControlTemplate>
</RepeatButton.Template>
</RepeatButton>
</Track.DecreaseRepeatButton>
<Track.Thumb>
<Thumb Style="{StaticResource UnifiedSliderThumbStyle}"/>
</Track.Thumb>
<Track.IncreaseRepeatButton>
<RepeatButton Command="{x:Static Slider.IncreaseLarge}" CommandTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}"
Height="5" BorderThickness="0" Focusable="False">
<RepeatButton.Template>
<ControlTemplate TargetType="RepeatButton">
<Border Background="{DynamicResource ToolAccentSoftBrush}" CornerRadius="3"/>
</ControlTemplate>
</RepeatButton.Template>
</RepeatButton>
</Track.IncreaseRepeatButton>
</Track>
</Grid>
</ControlTemplate>
<ControlTemplate x:Key="UnifiedVerticalSliderTemplate" TargetType="Slider">
<Grid Width="24" Background="Transparent">
<Track x:Name="PART_Track" HorizontalAlignment="Center" IsDirectionReversed="True">
<Track.DecreaseRepeatButton>
<RepeatButton Command="{x:Static Slider.DecreaseLarge}" CommandTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}"
Width="5" BorderThickness="0" Focusable="False">
<RepeatButton.Template>
<ControlTemplate TargetType="RepeatButton">
<Border Background="{DynamicResource MainColor}" CornerRadius="3"/>
</ControlTemplate>
</RepeatButton.Template>
</RepeatButton>
</Track.DecreaseRepeatButton>
<Track.Thumb>
<Thumb Style="{StaticResource UnifiedSliderThumbStyle}"/>
</Track.Thumb>
<Track.IncreaseRepeatButton>
<RepeatButton Command="{x:Static Slider.IncreaseLarge}" CommandTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}"
Width="5" BorderThickness="0" Focusable="False">
<RepeatButton.Template>
<ControlTemplate TargetType="RepeatButton">
<Border Background="{DynamicResource ToolAccentSoftBrush}" CornerRadius="3"/>
</ControlTemplate>
</RepeatButton.Template>
</RepeatButton>
</Track.IncreaseRepeatButton>
</Track>
</Grid>
</ControlTemplate>
<Style x:Key="UnifiedSliderStyle" TargetType="Slider">
<Setter Property="MinWidth" Value="100"/>
<Setter Property="Height" Value="24"/>
<Setter Property="Cursor" Value="Hand"/>
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
<Setter Property="Template" Value="{StaticResource UnifiedHorizontalSliderTemplate}"/>
<Style.Triggers>
<Trigger Property="Orientation" Value="Vertical">
<Setter Property="MinWidth" Value="24"/>
<Setter Property="Width" Value="24"/>
<Setter Property="Height" Value="Auto"/>
<Setter Property="MinHeight" Value="100"/>
<Setter Property="Template" Value="{StaticResource UnifiedVerticalSliderTemplate}"/>
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Opacity" Value="0.48"/>
<Setter Property="Cursor" Value="Arrow"/>
</Trigger>
</Style.Triggers>
</Style>
<Style TargetType="Slider" BasedOn="{StaticResource UnifiedSliderStyle}"/>
<!-- ColorPicker。 -->
<Style x:Key="ColorPickerSwatchItemStyle" TargetType="ListBoxItem">
<Setter Property="Width" Value="34"/>
<Setter Property="Height" Value="34"/>
<Setter Property="Margin" Value="3"/>
<Setter Property="Padding" Value="0"/>
<Setter Property="Cursor" Value="Hand"/>
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ListBoxItem">
<Grid ToolTip="{Binding Name}">
<Ellipse x:Name="SelectionRing" Fill="Transparent" Stroke="Transparent" StrokeThickness="2"/>
<Ellipse Margin="4" Fill="{Binding Brush}" Stroke="#26000000" StrokeThickness="1"/>
<Path x:Name="SelectedMark" Width="11" Height="8" Data="M 1,4 L 4,7 L 10,1"
Stretch="Fill" Stroke="White" StrokeThickness="2"
StrokeStartLineCap="Round" StrokeEndLineCap="Round" Visibility="Collapsed"/>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="SelectionRing" Property="Fill" Value="{DynamicResource ToolAccentSoftBrush}"/>
</Trigger>
<Trigger Property="IsSelected" Value="True">
<Setter TargetName="SelectionRing" Property="Stroke" Value="{DynamicResource MainColor}"/>
<Setter TargetName="SelectedMark" Property="Visibility" Value="Visible"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="controls:ColorPicker">
<Setter Property="MinWidth" Value="150"/>
<Setter Property="Height" Value="38"/>
<Setter Property="Foreground" Value="{DynamicResource ToolTextPrimaryBrush}"/>
<Setter Property="Background" Value="{DynamicResource ToolControlBackgroundBrush}"/>
<Setter Property="BorderBrush" Value="{DynamicResource ToolControlBorderBrush}"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="controls:ColorPicker">
<Grid x:Name="Root">
<ToggleButton Style="{x:Null}" Focusable="False"
IsChecked="{Binding IsDropDownOpen, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}">
<ToggleButton.Template>
<ControlTemplate TargetType="ToggleButton">
<Border x:Name="PickerSurface"
Background="{Binding Background, RelativeSource={RelativeSource AncestorType=controls:ColorPicker}}"
BorderBrush="{Binding BorderBrush, RelativeSource={RelativeSource AncestorType=controls:ColorPicker}}"
BorderThickness="{Binding BorderThickness, RelativeSource={RelativeSource AncestorType=controls:ColorPicker}}"
CornerRadius="11">
<Grid Margin="11,0,9,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="24"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="18"/>
</Grid.ColumnDefinitions>
<Ellipse Width="20" Height="20" Fill="{Binding SelectedBrush, RelativeSource={RelativeSource AncestorType=controls:ColorPicker}}"
Stroke="#26000000" StrokeThickness="1"/>
<TextBlock Grid.Column="1" Margin="8,0" Text="{Binding HexValue, RelativeSource={RelativeSource AncestorType=controls:ColorPicker}}"
Foreground="{Binding Foreground, RelativeSource={RelativeSource AncestorType=controls:ColorPicker}}"
FontFamily="Consolas" VerticalAlignment="Center"/>
<Path x:Name="Arrow" Grid.Column="2" Width="8" Height="5" Data="M 0,0 L 4,4 L 8,0 Z"
Stretch="Fill" Fill="{DynamicResource MainColor}"/>
</Grid>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="PickerSurface" Property="BorderBrush" Value="{DynamicResource ToolControlHoverBorderBrush}"/>
</Trigger>
<Trigger Property="IsChecked" Value="True">
<Setter TargetName="PickerSurface" Property="BorderBrush" Value="{DynamicResource MainColor}"/>
<Setter TargetName="Arrow" Property="RenderTransformOrigin" Value="0.5,0.5"/>
<Setter TargetName="Arrow" Property="RenderTransform"><Setter.Value><RotateTransform Angle="180"/></Setter.Value></Setter>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</ToggleButton.Template>
</ToggleButton>
<Popup x:Name="PART_TimePopup" Placement="Bottom" IsOpen="{Binding IsDropDownOpen, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"
StaysOpen="False" AllowsTransparency="True" PopupAnimation="Fade">
<Border Width="286" Margin="0,6,0,0" Padding="14"
Background="{DynamicResource ToolSurfaceBrush}"
BorderBrush="{DynamicResource ToolControlBorderBrush}" BorderThickness="1" CornerRadius="15">
<Border.Effect><DropShadowEffect Color="#514D74" BlurRadius="22" ShadowDepth="6" Opacity="0.2"/></Border.Effect>
<StackPanel>
<Grid Margin="2,0,2,9">
<Grid.ColumnDefinitions><ColumnDefinition Width="*"/><ColumnDefinition Width="Auto"/></Grid.ColumnDefinitions>
<TextBlock Text="选择颜色" Foreground="{DynamicResource ToolTextPrimaryBrush}" FontWeight="SemiBold"/>
<TextBlock Grid.Column="1" Text="{Binding SelectedColor.A, RelativeSource={RelativeSource TemplatedParent}, StringFormat=透明度 {0}}"
Foreground="{DynamicResource ToolTextSecondaryBrush}" FontSize="9"/>
</Grid>
<ListBox ItemsSource="{Binding Palette, RelativeSource={RelativeSource TemplatedParent}}"
SelectedValuePath="Color"
SelectedValue="{Binding SelectedColor, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"
ItemContainerStyle="{StaticResource ColorPickerSwatchItemStyle}"
Background="Transparent" BorderThickness="0" Padding="0" ScrollViewer.HorizontalScrollBarVisibility="Disabled">
<ListBox.ItemsPanel>
<ItemsPanelTemplate><WrapPanel/></ItemsPanelTemplate>
</ListBox.ItemsPanel>
</ListBox>
<Border Height="1" Margin="2,10" Background="{DynamicResource ToolDividerBrush}"/>
<Grid Margin="2,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="18"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="34"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="28"/><RowDefinition Height="28"/><RowDefinition Height="28"/>
</Grid.RowDefinitions>
<TextBlock Text="R" Foreground="#D1627E" FontWeight="SemiBold" VerticalAlignment="Center"/>
<Slider Grid.Column="1" Margin="5,0" Minimum="0" Maximum="255"
Value="{Binding Red, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"/>
<TextBlock Grid.Column="2" Text="{Binding Red, RelativeSource={RelativeSource TemplatedParent}, StringFormat={}{0:0}}"
Foreground="{DynamicResource ToolTextSecondaryBrush}" TextAlignment="Right" VerticalAlignment="Center"/>
<TextBlock Grid.Row="1" Text="G" Foreground="#4FAE79" FontWeight="SemiBold" VerticalAlignment="Center"/>
<Slider Grid.Row="1" Grid.Column="1" Margin="5,0" Minimum="0" Maximum="255"
Value="{Binding Green, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"/>
<TextBlock Grid.Row="1" Grid.Column="2" Text="{Binding Green, RelativeSource={RelativeSource TemplatedParent}, StringFormat={}{0:0}}"
Foreground="{DynamicResource ToolTextSecondaryBrush}" TextAlignment="Right" VerticalAlignment="Center"/>
<TextBlock Grid.Row="2" Text="B" Foreground="#5D9BEC" FontWeight="SemiBold" VerticalAlignment="Center"/>
<Slider Grid.Row="2" Grid.Column="1" Margin="5,0" Minimum="0" Maximum="255"
Value="{Binding Blue, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"/>
<TextBlock Grid.Row="2" Grid.Column="2" Text="{Binding Blue, RelativeSource={RelativeSource TemplatedParent}, StringFormat={}{0:0}}"
Foreground="{DynamicResource ToolTextSecondaryBrush}" TextAlignment="Right" VerticalAlignment="Center"/>
</Grid>
<TextBox Margin="2,9,2,0" Text="{Binding HexValue, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay, UpdateSourceTrigger=LostFocus}"
FontFamily="Consolas" HorizontalContentAlignment="Center" ToolTip="输入 #RRGGBB 或 #AARRGGBB"/>
</StackPanel>
</Border>
</Popup>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsEnabled" Value="False"><Setter Property="Opacity" Value="0.5"/></Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- DatePicker / CalendarPicker。 -->
<Style x:Key="UnifiedCalendarDayButtonStyle" TargetType="CalendarDayButton">
<Setter Property="MinWidth" Value="30"/>
<Setter Property="MinHeight" Value="28"/>
<Setter Property="Margin" Value="1"/>
<Setter Property="Foreground" Value="{DynamicResource ToolTextPrimaryBrush}"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Cursor" Value="Hand"/>
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="CalendarDayButton">
<Border x:Name="DaySurface" Background="{TemplateBinding Background}" CornerRadius="8">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True"><Setter TargetName="DaySurface" Property="Background" Value="{DynamicResource ToolControlHoverBrush}"/></Trigger>
<Trigger Property="IsToday" Value="True"><Setter TargetName="DaySurface" Property="BorderBrush" Value="{DynamicResource MainColor}"/><Setter TargetName="DaySurface" Property="BorderThickness" Value="1"/></Trigger>
<Trigger Property="IsSelected" Value="True"><Setter TargetName="DaySurface" Property="Background" Value="{DynamicResource MainColor}"/><Setter Property="Foreground" Value="White"/><Setter Property="FontWeight" Value="SemiBold"/></Trigger>
<Trigger Property="IsInactive" Value="True"><Setter Property="Opacity" Value="0.38"/></Trigger>
<Trigger Property="IsBlackedOut" Value="True"><Setter Property="Opacity" Value="0.28"/><Setter Property="TextBlock.TextDecorations" Value="Strikethrough"/></Trigger>
<Trigger Property="IsEnabled" Value="False"><Setter Property="Opacity" Value="0.25"/></Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="UnifiedCalendarButtonStyle" TargetType="CalendarButton">
<Setter Property="MinWidth" Value="58"/>
<Setter Property="MinHeight" Value="38"/>
<Setter Property="Margin" Value="2"/>
<Setter Property="Foreground" Value="{DynamicResource ToolTextPrimaryBrush}"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Cursor" Value="Hand"/>
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="CalendarButton">
<Border x:Name="MonthSurface" Padding="6" Background="{TemplateBinding Background}" CornerRadius="9">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True"><Setter TargetName="MonthSurface" Property="Background" Value="{DynamicResource ToolControlHoverBrush}"/></Trigger>
<Trigger Property="IsFocused" Value="True"><Setter TargetName="MonthSurface" Property="BorderBrush" Value="{DynamicResource MainColor}"/><Setter TargetName="MonthSurface" Property="BorderThickness" Value="1"/></Trigger>
<Trigger Property="IsEnabled" Value="False"><Setter Property="Opacity" Value="0.35"/></Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="UnifiedCalendarStyle" TargetType="Calendar">
<Setter Property="Background" Value="{DynamicResource ToolSurfaceBrush}"/>
<Setter Property="Foreground" Value="{DynamicResource ToolTextPrimaryBrush}"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="CalendarDayButtonStyle" Value="{StaticResource UnifiedCalendarDayButtonStyle}"/>
<Setter Property="CalendarButtonStyle" Value="{StaticResource UnifiedCalendarButtonStyle}"/>
</Style>
<Style TargetType="Calendar" BasedOn="{StaticResource UnifiedCalendarStyle}"/>
<Style x:Key="UnifiedDatePickerTextBoxStyle" TargetType="DatePickerTextBox">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="Foreground" Value="{DynamicResource ToolTextPrimaryBrush}"/>
<Setter Property="CaretBrush" Value="{DynamicResource MainColor}"/>
<Setter Property="SelectionBrush" Value="{DynamicResource MainColor}"/>
<Setter Property="Padding" Value="11,0"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="DatePickerTextBox">
<Grid Background="Transparent">
<ScrollViewer x:Name="PART_ContentHost" Margin="{TemplateBinding Padding}"
VerticalAlignment="Center" Focusable="False"/>
<ContentControl x:Name="PART_Watermark" Margin="{TemplateBinding Padding}"
Foreground="{DynamicResource ToolTextDisabledBrush}"
VerticalAlignment="Center" Focusable="False" IsHitTestVisible="False"
Visibility="Collapsed">
<TextBlock Text="{Binding PlaceholderText, RelativeSource={RelativeSource AncestorType=controls:CalendarPicker},
FallbackValue=选择日期, TargetNullValue=选择日期}"
Foreground="{DynamicResource ToolTextDisabledBrush}"/>
</ContentControl>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="Text" Value="">
<Setter TargetName="PART_Watermark" Property="Visibility" Value="Visible"/>
</Trigger>
<Trigger Property="Text" Value="{x:Null}">
<Setter TargetName="PART_Watermark" Property="Visibility" Value="Visible"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="UnifiedDatePickerStyle" TargetType="DatePicker">
<Setter Property="MinWidth" Value="150"/>
<Setter Property="Height" Value="38"/>
<Setter Property="Background" Value="{DynamicResource ToolControlBackgroundBrush}"/>
<Setter Property="Foreground" Value="{DynamicResource ToolTextPrimaryBrush}"/>
<Setter Property="BorderBrush" Value="{DynamicResource ToolControlBorderBrush}"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="CalendarStyle" Value="{StaticResource UnifiedCalendarStyle}"/>
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="DatePicker">
<Grid x:Name="Root">
<Border x:Name="DateSurface" Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="11">
<Grid>
<Grid.ColumnDefinitions><ColumnDefinition Width="*"/><ColumnDefinition Width="36"/></Grid.ColumnDefinitions>
<DatePickerTextBox x:Name="PART_TextBox" Style="{StaticResource UnifiedDatePickerTextBoxStyle}"/>
<Button x:Name="PART_Button" Grid.Column="1" Style="{x:Null}" Focusable="False">
<Button.Template>
<ControlTemplate TargetType="Button">
<Border x:Name="CalendarButtonSurface" Background="Transparent" CornerRadius="9" Margin="3">
<Grid Width="16" Height="16">
<Border Margin="1,2,1,1" BorderBrush="{DynamicResource MainColor}" BorderThickness="1.5" CornerRadius="2"/>
<Border Height="4" Margin="1,2,1,0" VerticalAlignment="Top" Background="{DynamicResource MainColor}" CornerRadius="2,2,0,0"/>
<Path Data="M 5,0 L 5,4 M 11,0 L 11,4" Stroke="{DynamicResource MainColor}" StrokeThickness="1.5"/>
</Grid>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True"><Setter TargetName="CalendarButtonSurface" Property="Background" Value="{DynamicResource ToolControlHoverBrush}"/></Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Button.Template>
</Button>
</Grid>
</Border>
<Popup x:Name="PART_Popup" Placement="Bottom" IsOpen="{TemplateBinding IsDropDownOpen}"
AllowsTransparency="True" Focusable="False" PopupAnimation="Fade">
<Border Margin="0,6,0,0" Padding="8" Background="{DynamicResource ToolSurfaceBrush}"
BorderBrush="{DynamicResource ToolControlBorderBrush}" BorderThickness="1" CornerRadius="15">
<Border.Effect><DropShadowEffect Color="#514D74" BlurRadius="22" ShadowDepth="6" Opacity="0.2"/></Border.Effect>
<Calendar x:Name="PART_Calendar" Style="{StaticResource UnifiedCalendarStyle}"/>
</Border>
</Popup>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsKeyboardFocusWithin" Value="True"><Setter TargetName="DateSurface" Property="BorderBrush" Value="{DynamicResource MainColor}"/><Setter TargetName="DateSurface" Property="BorderThickness" Value="1.5"/></Trigger>
<Trigger Property="IsMouseOver" Value="True"><Setter TargetName="DateSurface" Property="BorderBrush" Value="{DynamicResource ToolControlHoverBorderBrush}"/></Trigger>
<Trigger Property="IsEnabled" Value="False"><Setter Property="Opacity" Value="0.5"/></Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="DatePicker" BasedOn="{StaticResource UnifiedDatePickerStyle}"/>
<Style TargetType="controls:CalendarPicker" BasedOn="{StaticResource UnifiedDatePickerStyle}"/>
<!-- TimePicker。 -->
<Style x:Key="TimePickerListItemStyle" TargetType="ListBoxItem">
<Setter Property="Width" Value="60"/>
<Setter Property="Height" Value="34"/>
<Setter Property="Margin" Value="2"/>
<Setter Property="Foreground" Value="{DynamicResource ToolTextPrimaryBrush}"/>
<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="Cursor" Value="Hand"/>
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ListBoxItem">
<Border x:Name="TimeSurface" Background="Transparent" CornerRadius="9">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True"><Setter TargetName="TimeSurface" Property="Background" Value="{DynamicResource ToolControlHoverBrush}"/></Trigger>
<Trigger Property="IsSelected" Value="True"><Setter TargetName="TimeSurface" Property="Background" Value="{DynamicResource ToolAccentSelectedBrush}"/><Setter Property="Foreground" Value="{DynamicResource MainColor}"/><Setter Property="FontWeight" Value="SemiBold"/></Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="TimePickerListStyle" TargetType="ListBox">
<Setter Property="Width" Value="80"/>
<Setter Property="Height" Value="180"/>
<Setter Property="Padding" Value="3,3,1,8"/>
<Setter Property="Margin" Value="0,0,0,3"/>
<Setter Property="Background" Value="{DynamicResource ToolControlBackgroundBrush}"/>
<Setter Property="Foreground" Value="{DynamicResource ToolTextPrimaryBrush}"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="ItemContainerStyle" Value="{StaticResource TimePickerListItemStyle}"/>
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled"/>
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
<Setter Property="ScrollViewer.CanContentScroll" Value="False"/>
<Setter Property="VirtualizingPanel.IsVirtualizing" Value="False"/>
</Style>
<Style TargetType="controls:TimePicker">
<Setter Property="MinWidth" Value="142"/>
<Setter Property="Height" Value="38"/>
<Setter Property="Foreground" Value="{DynamicResource ToolTextPrimaryBrush}"/>
<Setter Property="Background" Value="{DynamicResource ToolControlBackgroundBrush}"/>
<Setter Property="BorderBrush" Value="{DynamicResource ToolControlBorderBrush}"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="controls:TimePicker">
<Grid x:Name="Root">
<ToggleButton Style="{x:Null}" Focusable="False"
IsChecked="{Binding IsDropDownOpen, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}">
<ToggleButton.Template>
<ControlTemplate TargetType="ToggleButton">
<Border x:Name="TimePickerSurface"
Background="{Binding Background, RelativeSource={RelativeSource AncestorType=controls:TimePicker}}"
BorderBrush="{Binding BorderBrush, RelativeSource={RelativeSource AncestorType=controls:TimePicker}}"
BorderThickness="{Binding BorderThickness, RelativeSource={RelativeSource AncestorType=controls:TimePicker}}"
CornerRadius="11">
<Grid Margin="11,0,9,0">
<Grid.ColumnDefinitions><ColumnDefinition Width="24"/><ColumnDefinition Width="*"/><ColumnDefinition Width="18"/></Grid.ColumnDefinitions>
<Grid Width="18" Height="18">
<Ellipse Stroke="{DynamicResource MainColor}" StrokeThickness="1.5"/>
<Path Data="M 9,4 L 9,9 L 13,11" Stroke="{DynamicResource MainColor}" StrokeThickness="1.5"
StrokeStartLineCap="Round" StrokeEndLineCap="Round"/>
</Grid>
<TextBlock Grid.Column="1" Margin="8,0" Text="{Binding DisplayText, RelativeSource={RelativeSource AncestorType=controls:TimePicker}}"
Foreground="{Binding Foreground, RelativeSource={RelativeSource AncestorType=controls:TimePicker}}"
VerticalAlignment="Center"/>
<Path x:Name="Arrow" Grid.Column="2" Width="8" Height="5" Data="M 0,0 L 4,4 L 8,0 Z" Stretch="Fill" Fill="{DynamicResource MainColor}"/>
</Grid>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True"><Setter TargetName="TimePickerSurface" Property="BorderBrush" Value="{DynamicResource ToolControlHoverBorderBrush}"/></Trigger>
<Trigger Property="IsChecked" Value="True"><Setter TargetName="TimePickerSurface" Property="BorderBrush" Value="{DynamicResource MainColor}"/><Setter TargetName="Arrow" Property="RenderTransformOrigin" Value="0.5,0.5"/><Setter TargetName="Arrow" Property="RenderTransform"><Setter.Value><RotateTransform Angle="180"/></Setter.Value></Setter></Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</ToggleButton.Template>
</ToggleButton>
<Popup Placement="Bottom" IsOpen="{Binding IsDropDownOpen, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"
StaysOpen="False" AllowsTransparency="True" PopupAnimation="Fade">
<Border Width="308" Margin="0,6,0,0" Padding="12" Background="{DynamicResource ToolSurfaceBrush}"
BorderBrush="{DynamicResource ToolControlBorderBrush}" BorderThickness="1" CornerRadius="15">
<Border.Effect><DropShadowEffect Color="#514D74" BlurRadius="22" ShadowDepth="6" Opacity="0.2"/></Border.Effect>
<Grid>
<Grid.RowDefinitions><RowDefinition Height="Auto"/><RowDefinition Height="Auto"/></Grid.RowDefinitions>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
<StackPanel Width="80" Visibility="{Binding ShowHour, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource TimePickerBooleanToVisibilityConverter}}">
<TextBlock Text="小时" Margin="0,0,0,8" Foreground="{DynamicResource ToolTextSecondaryBrush}" FontSize="9.5" HorizontalAlignment="Center"/>
<ListBox x:Name="PART_HourList" Style="{StaticResource TimePickerListStyle}"
ItemsSource="{Binding Hours, RelativeSource={RelativeSource TemplatedParent}}"
SelectedItem="{Binding Hour, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"/>
</StackPanel>
<TextBlock Text=":" Width="16" Foreground="{DynamicResource MainColor}" FontSize="18" FontWeight="Bold"
HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Visibility" Value="Collapsed"/>
<Style.Triggers>
<MultiDataTrigger>
<MultiDataTrigger.Conditions>
<Condition Binding="{Binding ShowHour, RelativeSource={RelativeSource TemplatedParent}}" Value="True"/>
<Condition Binding="{Binding ShowMinute, RelativeSource={RelativeSource TemplatedParent}}" Value="True"/>
</MultiDataTrigger.Conditions>
<Setter Property="Visibility" Value="Visible"/>
</MultiDataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
<StackPanel Width="80" Visibility="{Binding ShowMinute, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource TimePickerBooleanToVisibilityConverter}}">
<TextBlock Text="分钟" Margin="0,0,0,8" Foreground="{DynamicResource ToolTextSecondaryBrush}" FontSize="9.5" HorizontalAlignment="Center"/>
<ListBox x:Name="PART_MinuteList" Style="{StaticResource TimePickerListStyle}"
ItemsSource="{Binding Minutes, RelativeSource={RelativeSource TemplatedParent}}"
SelectedItem="{Binding Minute, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"/>
</StackPanel>
<TextBlock Text=":" Width="16" Foreground="{DynamicResource MainColor}" FontSize="18" FontWeight="Bold"
HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Visibility" Value="Collapsed"/>
<Style.Triggers>
<MultiDataTrigger>
<MultiDataTrigger.Conditions>
<Condition Binding="{Binding ShowHour, RelativeSource={RelativeSource TemplatedParent}}" Value="True"/>
<Condition Binding="{Binding ShowSecond, RelativeSource={RelativeSource TemplatedParent}}" Value="True"/>
</MultiDataTrigger.Conditions>
<Setter Property="Visibility" Value="Visible"/>
</MultiDataTrigger>
<MultiDataTrigger>
<MultiDataTrigger.Conditions>
<Condition Binding="{Binding ShowMinute, RelativeSource={RelativeSource TemplatedParent}}" Value="True"/>
<Condition Binding="{Binding ShowSecond, RelativeSource={RelativeSource TemplatedParent}}" Value="True"/>
</MultiDataTrigger.Conditions>
<Setter Property="Visibility" Value="Visible"/>
</MultiDataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
<StackPanel Width="80" Visibility="{Binding ShowSecond, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource TimePickerBooleanToVisibilityConverter}}">
<TextBlock Text="秒钟" Margin="0,0,0,8" Foreground="{DynamicResource ToolTextSecondaryBrush}" FontSize="9.5" HorizontalAlignment="Center"/>
<ListBox x:Name="PART_SecondList" Style="{StaticResource TimePickerListStyle}"
ItemsSource="{Binding Seconds, RelativeSource={RelativeSource TemplatedParent}}"
SelectedItem="{Binding Second, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"/>
</StackPanel>
</StackPanel>
<Grid Grid.Row="1" Margin="0,10,0,0">
<Grid.ColumnDefinitions><ColumnDefinition Width="*"/><ColumnDefinition Width="6"/><ColumnDefinition Width="*"/><ColumnDefinition Width="6"/><ColumnDefinition Width="*"/></Grid.ColumnDefinitions>
<Button Content="现在" Height="32" MinWidth="0" Padding="7,0"
Command="{x:Static controls:TimePicker.SelectNowCommand}"
CommandTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}"/>
<Button Grid.Column="2" Content="清除" Height="32" MinWidth="0" Padding="7,0"
Command="{x:Static controls:TimePicker.ClearTimeCommand}"
CommandTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}"/>
<Button Grid.Column="4" Content="完成" Height="32" MinWidth="0" Padding="7,0"
controls:ButtonAssist.IsPrimary="True"
Command="{x:Static controls:TimePicker.ConfirmTimeCommand}"
CommandTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}"/>
</Grid>
</Grid>
</Border>
</Popup>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsEnabled" Value="False"><Setter Property="Opacity" Value="0.5"/></Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:XFEToolBox.WpfCore.Controls">
<BooleanToVisibilityConverter x:Key="TimePickerBooleanToVisibilityConverter"/>
<!-- 统一进度控件。 -->
<Style x:Key="UnifiedProgressBarStyle" TargetType="ProgressBar">
<Setter Property="Height" Value="8"/>
<Setter Property="MinWidth" Value="80"/>
<Setter Property="Foreground" Value="{DynamicResource MainColor}"/>
<Setter Property="Background" Value="{DynamicResource ToolAccentSoftBrush}"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ProgressBar">
<controls:RoundedClipBorder Background="{TemplateBinding Background}" CornerRadius="4">
<Grid x:Name="PART_Track" ClipToBounds="True">
<Border x:Name="PART_Indicator" HorizontalAlignment="Left"
Background="{TemplateBinding Foreground}" CornerRadius="4"/>
<Border x:Name="IndeterminateBar" Width="56" HorizontalAlignment="Left"
Background="{TemplateBinding Foreground}" CornerRadius="4" Visibility="Collapsed">
<Border.RenderTransform>
<TranslateTransform x:Name="IndeterminateTransform" X="-70"/>
</Border.RenderTransform>
</Border>
</Grid>
</controls:RoundedClipBorder>
<ControlTemplate.Triggers>
<Trigger Property="IsIndeterminate" Value="True">
<Setter TargetName="PART_Indicator" Property="Visibility" Value="Collapsed"/>
<Setter TargetName="IndeterminateBar" Property="Visibility" Value="Visible"/>
<Trigger.EnterActions>
<BeginStoryboard x:Name="IndeterminateStoryboard">
<Storyboard>
<DoubleAnimation Storyboard.TargetName="IndeterminateTransform"
Storyboard.TargetProperty="X" From="-70" To="420"
Duration="0:0:1.35" RepeatBehavior="Forever"/>
</Storyboard>
</BeginStoryboard>
</Trigger.EnterActions>
<Trigger.ExitActions>
<StopStoryboard BeginStoryboardName="IndeterminateStoryboard"/>
</Trigger.ExitActions>
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Opacity" Value="0.48"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="ProgressBar" BasedOn="{StaticResource UnifiedProgressBarStyle}"/>
<Style TargetType="controls:ProgressRing">
<Setter Property="Width" Value="32"/>
<Setter Property="Height" Value="32"/>
<Setter Property="Foreground" Value="{DynamicResource MainColor}"/>
<Setter Property="Background" Value="{DynamicResource ToolAccentSoftBrush}"/>
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="controls:ProgressRing">
<Border Background="Transparent"/>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Opacity" Value="0.25"/>
</Trigger>
</Style.Triggers>
</Style>
<!-- CommandBar:主命令位于中间,Header 和 SecondaryContent 可选。 -->
<Style TargetType="controls:CommandBar">
<Setter Property="MinHeight" Value="52"/>
<Setter Property="Padding" Value="10,8"/>
<Setter Property="Background" Value="{DynamicResource ToolSurfaceBrush}"/>
<Setter Property="BorderBrush" Value="{DynamicResource ToolControlBorderBrush}"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="Foreground" Value="{DynamicResource ToolTextPrimaryBrush}"/>
<Setter Property="ItemsPanel">
<Setter.Value>
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal" VerticalAlignment="Center"/>
</ItemsPanelTemplate>
</Setter.Value>
</Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="controls:CommandBar">
<Border x:Name="Surface" Padding="{TemplateBinding Padding}"
Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="15">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<ContentPresenter x:Name="HeaderPresenter" ContentSource="Header"
Margin="4,0,14,0" VerticalAlignment="Center"
TextElement.FontWeight="SemiBold"/>
<ItemsPresenter Grid.Column="1" VerticalAlignment="Center"/>
<ContentPresenter x:Name="SecondaryPresenter" Grid.Column="2"
Content="{TemplateBinding SecondaryContent}"
Margin="14,0,2,0" VerticalAlignment="Center"/>
</Grid>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="Header" Value="{x:Null}">
<Setter TargetName="HeaderPresenter" Property="Visibility" Value="Collapsed"/>
</Trigger>
<Trigger Property="SecondaryContent" Value="{x:Null}">
<Setter TargetName="SecondaryPresenter" Property="Visibility" Value="Collapsed"/>
</Trigger>
<Trigger Property="IsCompact" Value="True">
<Setter Property="MinHeight" Value="42"/>
<Setter Property="Padding" Value="7,5"/>
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter TargetName="Surface" Property="Opacity" Value="0.55"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- AutoSuggestBox。 -->
<Style x:Key="AutoSuggestBoxItemStyle" TargetType="ComboBoxItem">
<Setter Property="MinHeight" Value="34"/>
<Setter Property="Padding" Value="11,8"/>
<Setter Property="Margin" Value="0,1"/>
<Setter Property="Foreground" Value="{DynamicResource ToolTextPrimaryBrush}"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
<Setter Property="Cursor" Value="Hand"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ComboBoxItem">
<Border x:Name="SuggestionSurface" Padding="{TemplateBinding Padding}"
Background="{TemplateBinding Background}" CornerRadius="9">
<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="Center"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsHighlighted" Value="True">
<Setter TargetName="SuggestionSurface" Property="Background" Value="{DynamicResource ToolControlHoverBrush}"/>
</Trigger>
<Trigger Property="IsSelected" Value="True">
<Setter TargetName="SuggestionSurface" Property="Background" Value="{DynamicResource ToolAccentSelectedBrush}"/>
<Setter Property="Foreground" Value="{DynamicResource MainColor}"/>
</Trigger>
<Trigger Property="IsEnabled" Value="False"><Setter Property="Opacity" Value="0.45"/></Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="controls:AutoSuggestBox">
<Setter Property="MinHeight" Value="38"/>
<Setter Property="Padding" Value="36,0,34,0"/>
<Setter Property="Foreground" Value="{DynamicResource ToolTextPrimaryBrush}"/>
<Setter Property="Background" Value="{DynamicResource ToolControlBackgroundBrush}"/>
<Setter Property="BorderBrush" Value="{DynamicResource ToolControlBorderBrush}"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="ItemContainerStyle" Value="{StaticResource AutoSuggestBoxItemStyle}"/>
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="controls:AutoSuggestBox">
<Grid x:Name="Root">
<Border x:Name="Surface" Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="11">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="36"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="32"/>
</Grid.ColumnDefinitions>
<Path Width="14" Height="14" Data="M 7,1 A 6,6 0 1 1 7,13 A 6,6 0 1 1 7,1 M 11.3,11.3 L 15,15"
Stretch="Uniform" Stroke="{DynamicResource MainColor}" StrokeThickness="1.7"
StrokeStartLineCap="Round" StrokeEndLineCap="Round"/>
<Grid Grid.Column="1" Margin="0,2">
<TextBox x:Name="PART_EditableTextBox" Style="{x:Null}" Background="Transparent"
BorderThickness="0" Foreground="{TemplateBinding Foreground}"
CaretBrush="{DynamicResource MainColor}"
SelectionBrush="{DynamicResource MainColor}"
FocusVisualStyle="{x:Null}"
VerticalContentAlignment="Center"/>
<TextBlock x:Name="Placeholder" Text="{TemplateBinding PlaceholderText}" Visibility="Collapsed"
Foreground="{DynamicResource ToolTextDisabledBrush}"
VerticalAlignment="Center" IsHitTestVisible="False"/>
</Grid>
<ToggleButton Grid.Column="2" Style="{x:Null}" Focusable="False"
IsChecked="{Binding IsDropDownOpen, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}">
<ToggleButton.Template>
<ControlTemplate TargetType="ToggleButton">
<Grid Background="Transparent">
<Path x:Name="Arrow" Width="8" Height="5" Data="M 0,0 L 4,4 L 8,0 Z"
Stretch="Fill" Fill="{DynamicResource MainColor}"
HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsChecked" Value="True">
<Setter TargetName="Arrow" Property="RenderTransformOrigin" Value="0.5,0.5"/>
<Setter TargetName="Arrow" Property="RenderTransform">
<Setter.Value><RotateTransform Angle="180"/></Setter.Value>
</Setter>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</ToggleButton.Template>
</ToggleButton>
</Grid>
</Border>
<Popup x:Name="PART_Popup" Placement="Bottom" IsOpen="{TemplateBinding IsDropDownOpen}"
AllowsTransparency="True" Focusable="False" PopupAnimation="Fade">
<Border MinWidth="{Binding ActualWidth, ElementName=Root}" Margin="0,6,0,0" Padding="5"
Background="{DynamicResource ToolSurfaceBrush}"
BorderBrush="{DynamicResource ToolControlBorderBrush}" BorderThickness="1" CornerRadius="12">
<Border.Effect>
<DropShadowEffect Color="#514D74" BlurRadius="20" ShadowDepth="5" Opacity="0.18"/>
</Border.Effect>
<ScrollViewer MaxHeight="248" HorizontalScrollBarVisibility="Disabled"
VerticalScrollBarVisibility="Auto">
<ItemsPresenter KeyboardNavigation.DirectionalNavigation="Contained"/>
</ScrollViewer>
</Border>
</Popup>
</Grid>
<ControlTemplate.Triggers>
<Trigger SourceName="PART_EditableTextBox" Property="Text" Value="">
<Setter TargetName="Placeholder" Property="Visibility" Value="Visible"/>
</Trigger>
<Trigger SourceName="PART_EditableTextBox" Property="Text" Value="{x:Null}">
<Setter TargetName="Placeholder" Property="Visibility" Value="Visible"/>
</Trigger>
<Trigger Property="IsKeyboardFocusWithin" Value="True">
<Setter TargetName="Surface" Property="BorderBrush" Value="{DynamicResource MainColor}"/>
<Setter TargetName="Surface" Property="BorderThickness" Value="1.5"/>
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="Surface" Property="BorderBrush" Value="{DynamicResource ToolControlHoverBorderBrush}"/>
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Opacity" Value="0.55"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- InfoBar。 -->
<Style TargetType="controls:InfoBar">
<Setter Property="Padding" Value="14,12"/>
<Setter Property="Background" Value="#F1F1FC"/>
<Setter Property="BorderBrush" Value="#DADAEE"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="Foreground" Value="{DynamicResource ToolTextPrimaryBrush}"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="controls:InfoBar">
<Border x:Name="InfoSurface" Padding="{TemplateBinding Padding}"
Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="13">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="28"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Border x:Name="IconSurface" Width="22" Height="22" HorizontalAlignment="Left"
VerticalAlignment="Top" Background="{DynamicResource MainColor}" CornerRadius="11">
<TextBlock x:Name="SeverityIcon" Text="i" Foreground="White" FontWeight="Bold"
HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
<StackPanel Grid.Column="1" Margin="2,0,12,0">
<TextBlock x:Name="TitlePresenter" Text="{TemplateBinding Title}"
FontSize="12" FontWeight="SemiBold" TextWrapping="Wrap"/>
<TextBlock x:Name="MessagePresenter" Text="{TemplateBinding Message}"
Margin="0,3,0,0" Foreground="{DynamicResource ToolTextSecondaryBrush}"
FontSize="10.5" TextWrapping="Wrap"/>
<ContentPresenter Content="{TemplateBinding Content}" Margin="0,8,0,0"/>
</StackPanel>
<ContentPresenter x:Name="ActionPresenter" Grid.Column="2"
Content="{TemplateBinding ActionContent}" Margin="8,0"
VerticalAlignment="Center"/>
<Button x:Name="PART_CloseButton" Grid.Column="3" Width="28" Height="28" MinWidth="0"
Padding="0" Margin="5,-4,-5,-4" ToolTip="关闭" Style="{x:Null}">
<Button.Template>
<ControlTemplate TargetType="Button">
<Border x:Name="CloseSurface" Background="Transparent" CornerRadius="8">
<Path Width="10" Height="10" Data="M 1,1 L 9,9 M 9,1 L 1,9"
Stretch="Fill" Stroke="{DynamicResource ToolTextSecondaryBrush}"
StrokeThickness="1.5" StrokeStartLineCap="Round" StrokeEndLineCap="Round"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="CloseSurface" Property="Background" Value="#18000000"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Button.Template>
</Button>
</Grid>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsOpen" Value="False">
<Setter Property="Visibility" Value="Collapsed"/>
</Trigger>
<Trigger Property="IsClosable" Value="False">
<Setter TargetName="PART_CloseButton" Property="Visibility" Value="Collapsed"/>
</Trigger>
<Trigger Property="Title" Value="">
<Setter TargetName="TitlePresenter" Property="Visibility" Value="Collapsed"/>
<Setter TargetName="MessagePresenter" Property="Margin" Value="0"/>
</Trigger>
<Trigger Property="Content" Value="{x:Null}">
<Setter TargetName="ActionPresenter" Property="VerticalAlignment" Value="Center"/>
</Trigger>
<Trigger Property="Severity" Value="Success">
<Setter TargetName="InfoSurface" Property="Background" Value="#EFF9F3"/>
<Setter TargetName="InfoSurface" Property="BorderBrush" Value="#CDE9D7"/>
<Setter TargetName="IconSurface" Property="Background" Value="#55A978"/>
<Setter TargetName="SeverityIcon" Property="Text" Value="✓"/>
</Trigger>
<Trigger Property="Severity" Value="Warning">
<Setter TargetName="InfoSurface" Property="Background" Value="#FFF8EA"/>
<Setter TargetName="InfoSurface" Property="BorderBrush" Value="#F1DCA8"/>
<Setter TargetName="IconSurface" Property="Background" Value="#D69A34"/>
<Setter TargetName="SeverityIcon" Property="Text" Value="!"/>
</Trigger>
<Trigger Property="Severity" Value="Error">
<Setter TargetName="InfoSurface" Property="Background" Value="#FFF1F3"/>
<Setter TargetName="InfoSurface" Property="BorderBrush" Value="#F0CDD3"/>
<Setter TargetName="IconSurface" Property="Background" Value="{DynamicResource ToolDangerBrush}"/>
<Setter TargetName="SeverityIcon" Property="Text" Value="×"/>
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter TargetName="InfoSurface" Property="Opacity" Value="0.55"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- 统一头像;没有图片时自动展示姓名首字。 -->
<Style TargetType="controls:PersonPicture">
<Setter Property="Width" Value="36"/>
<Setter Property="Height" Value="36"/>
<Setter Property="FontSize" Value="13"/>
<Setter Property="Foreground" Value="White"/>
<Setter Property="Background" Value="{DynamicResource MainColor}"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="controls:PersonPicture">
<Grid>
<Ellipse x:Name="AvatarSurface" Fill="{TemplateBinding Background}"
Stroke="#72FFFFFF" StrokeThickness="1"/>
<TextBlock Text="{TemplateBinding ResolvedInitials}" Foreground="{TemplateBinding Foreground}"
FontWeight="Bold" FontSize="{TemplateBinding FontSize}"
HorizontalAlignment="Center" VerticalAlignment="Center"/>
<Ellipse x:Name="Photo" Stroke="#72FFFFFF" StrokeThickness="1">
<Ellipse.Fill>
<ImageBrush ImageSource="{TemplateBinding ProfilePicture}" Stretch="UniformToFill"/>
</Ellipse.Fill>
</Ellipse>
<Ellipse x:Name="OnlineBadge" Width="10" Height="10" HorizontalAlignment="Right"
VerticalAlignment="Bottom" Fill="#54D88B" Stroke="White" StrokeThickness="2"
Visibility="Collapsed"/>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="ProfilePicture" Value="{x:Null}">
<Setter TargetName="Photo" Property="Visibility" Value="Collapsed"/>
</Trigger>
<Trigger Property="IsOnline" Value="True">
<Setter TargetName="OnlineBadge" Property="Visibility" Value="Visible"/>
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter TargetName="AvatarSurface" Property="Opacity" Value="0.45"/>
<Setter TargetName="Photo" Property="Opacity" Value="0.45"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- Expander。 -->
<Style x:Key="UnifiedExpanderStyle" TargetType="Expander">
<Setter Property="Foreground" Value="{DynamicResource ToolTextPrimaryBrush}"/>
<Setter Property="Background" Value="{DynamicResource ToolSurfaceBrush}"/>
<Setter Property="BorderBrush" Value="{DynamicResource ToolControlBorderBrush}"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Expander">
<Border x:Name="Surface" Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="13">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<ToggleButton x:Name="HeaderSite" MinHeight="44" Padding="14,8"
Style="{x:Null}" IsChecked="{Binding IsExpanded, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}">
<ToggleButton.Template>
<ControlTemplate TargetType="ToggleButton">
<Border x:Name="HeaderSurface" Background="Transparent" CornerRadius="12">
<Grid Margin="{TemplateBinding Padding}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="24"/>
</Grid.ColumnDefinitions>
<ContentPresenter ContentSource="Content" VerticalAlignment="Center"
TextElement.FontWeight="SemiBold"/>
<Border Grid.Column="1" Width="24" Height="24" CornerRadius="8"
Background="{DynamicResource ToolAccentSoftBrush}">
<Path x:Name="Arrow" Width="7" Height="11" Data="M 1,1 L 6,5.5 L 1,10"
Stretch="Fill" Stroke="{DynamicResource MainColor}" StrokeThickness="1.6"
StrokeStartLineCap="Round" StrokeEndLineCap="Round"/>
</Border>
</Grid>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="HeaderSurface" Property="Background" Value="{DynamicResource ToolControlHoverBrush}"/>
</Trigger>
<Trigger Property="IsChecked" Value="True">
<Setter TargetName="Arrow" Property="RenderTransformOrigin" Value="0.5,0.5"/>
<Setter TargetName="Arrow" Property="RenderTransform">
<Setter.Value><RotateTransform Angle="90"/></Setter.Value>
</Setter>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</ToggleButton.Template>
<ContentPresenter ContentSource="Header"/>
</ToggleButton>
<Border x:Name="ExpandSite" Grid.Row="1" Margin="14,0,14,14" Padding="0,12,0,0"
BorderBrush="{DynamicResource ToolDividerBrush}" BorderThickness="0,1,0,0"
Visibility="Collapsed">
<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
</Border>
</Grid>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsExpanded" Value="True">
<Setter TargetName="ExpandSite" Property="Visibility" Value="Visible"/>
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter TargetName="Surface" Property="Opacity" Value="0.5"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="Expander" BasedOn="{StaticResource UnifiedExpanderStyle}"/>
<!-- Image 默认使用高质量缩放;需要圆角时可使用 UnifiedRoundedImageStyle。 -->
<Style x:Key="UnifiedImageStyle" TargetType="Image">
<Setter Property="Stretch" Value="Uniform"/>
<Setter Property="SnapsToDevicePixels" Value="True"/>
<Setter Property="RenderOptions.BitmapScalingMode" Value="HighQuality"/>
<Setter Property="controls:ControlAssist.CornerRadius" Value="0"/>
</Style>
<Style x:Key="UnifiedRoundedImageStyle" TargetType="Image" BasedOn="{StaticResource UnifiedImageStyle}">
<Setter Property="Stretch" Value="UniformToFill"/>
<Setter Property="controls:ControlAssist.CornerRadius" Value="14"/>
</Style>
<Style TargetType="Image" BasedOn="{StaticResource UnifiedImageStyle}"/>
<!-- RadioButton 和 ToggleButton。 -->
<Style x:Key="UnifiedRadioButtonStyle" TargetType="RadioButton">
<Setter Property="MinHeight" Value="24"/>
<Setter Property="Foreground" Value="{DynamicResource ToolTextPrimaryBrush}"/>
<Setter Property="FontSize" Value="11"/>
<Setter Property="Cursor" Value="Hand"/>
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="RadioButton">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="24"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Border x:Name="Ring" Width="18" Height="18" HorizontalAlignment="Left"
Background="{DynamicResource ToolControlBackgroundBrush}"
BorderBrush="{DynamicResource ToolControlBorderBrush}"
BorderThickness="1" CornerRadius="9"/>
<Ellipse x:Name="Dot" Width="8" Height="8" HorizontalAlignment="Left" Margin="5,0,0,0"
Fill="{DynamicResource MainColor}" Opacity="0" RenderTransformOrigin="0.5,0.5">
<Ellipse.RenderTransform><ScaleTransform ScaleX="0.5" ScaleY="0.5"/></Ellipse.RenderTransform>
</Ellipse>
<ContentPresenter Grid.Column="1" Margin="3,0,0,0"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="Ring" Property="Background" Value="{DynamicResource ToolAccentSoftBrush}"/>
<Setter TargetName="Ring" Property="BorderBrush" Value="{DynamicResource MainColor}"/>
</Trigger>
<Trigger Property="IsChecked" Value="True">
<Setter TargetName="Ring" Property="BorderBrush" Value="{DynamicResource MainColor}"/>
<Setter TargetName="Ring" Property="BorderThickness" Value="1.5"/>
<Setter TargetName="Dot" Property="Opacity" Value="1"/>
<Setter TargetName="Dot" Property="RenderTransform">
<Setter.Value><ScaleTransform ScaleX="1" ScaleY="1"/></Setter.Value>
</Setter>
</Trigger>
<Trigger Property="IsKeyboardFocused" Value="True">
<Setter TargetName="Ring" Property="BorderBrush" Value="{DynamicResource MainColor}"/>
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Opacity" Value="0.48"/>
<Setter Property="Cursor" Value="Arrow"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="RadioButton" BasedOn="{StaticResource UnifiedRadioButtonStyle}"/>
<Style x:Key="UnifiedToggleButtonStyle" TargetType="ToggleButton">
<Setter Property="Height" Value="36"/>
<Setter Property="MinWidth" Value="66"/>
<Setter Property="Padding" Value="14,0"/>
<Setter Property="Foreground" Value="{DynamicResource ToolTextPrimaryBrush}"/>
<Setter Property="Background" Value="{DynamicResource ToolControlBackgroundBrush}"/>
<Setter Property="BorderBrush" Value="{DynamicResource ToolControlBorderBrush}"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
<Setter Property="Cursor" Value="Hand"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ToggleButton">
<Border x:Name="ToggleSurface" Padding="{TemplateBinding Padding}"
Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="11">
<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="ToggleSurface" Property="Background" Value="{DynamicResource ToolControlHoverBrush}"/>
<Setter TargetName="ToggleSurface" Property="BorderBrush" Value="{DynamicResource ToolControlHoverBorderBrush}"/>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter TargetName="ToggleSurface" Property="Background" Value="{DynamicResource ToolControlPressedBrush}"/>
</Trigger>
<Trigger Property="IsChecked" Value="True">
<Setter TargetName="ToggleSurface" Property="Background" Value="{DynamicResource ToolAccentSelectedBrush}"/>
<Setter TargetName="ToggleSurface" Property="BorderBrush" Value="{DynamicResource MainColor}"/>
<Setter Property="Foreground" Value="{DynamicResource MainColor}"/>
<Setter Property="FontWeight" Value="SemiBold"/>
</Trigger>
<Trigger Property="IsKeyboardFocused" Value="True">
<Setter TargetName="ToggleSurface" Property="BorderBrush" Value="{DynamicResource MainColor}"/>
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Opacity" Value="0.48"/>
<Setter Property="Cursor" Value="Arrow"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="ToggleButton" BasedOn="{StaticResource UnifiedToggleButtonStyle}"/>
<!-- Slider。 -->
<Style x:Key="UnifiedSliderThumbStyle" TargetType="Thumb">
<Setter Property="Width" Value="18"/>
<Setter Property="Height" Value="18"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Thumb">
<Grid>
<Ellipse x:Name="ThumbShadow" Width="18" Height="18" Fill="#22000000" Margin="0,2,0,-2"/>
<Ellipse x:Name="ThumbSurface" Width="18" Height="18" Fill="White"
Stroke="{DynamicResource MainColor}" StrokeThickness="2"/>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="ThumbSurface" Property="Fill" Value="{DynamicResource ToolAccentSoftBrush}"/>
<Setter TargetName="ThumbSurface" Property="StrokeThickness" Value="2.5"/>
</Trigger>
<Trigger Property="IsDragging" Value="True">
<Setter TargetName="ThumbSurface" Property="Fill" Value="{DynamicResource MainColor}"/>
<Setter TargetName="ThumbSurface" Property="Stroke" Value="White"/>
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Opacity" Value="0.45"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<ControlTemplate x:Key="UnifiedHorizontalSliderTemplate" TargetType="Slider">
<Grid Height="24" Background="Transparent">
<Track x:Name="PART_Track" VerticalAlignment="Center">
<Track.DecreaseRepeatButton>
<RepeatButton Command="{x:Static Slider.DecreaseLarge}" CommandTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}"
Height="5" BorderThickness="0" Focusable="False">
<RepeatButton.Template>
<ControlTemplate TargetType="RepeatButton">
<Border Background="{DynamicResource MainColor}" CornerRadius="3"/>
</ControlTemplate>
</RepeatButton.Template>
</RepeatButton>
</Track.DecreaseRepeatButton>
<Track.Thumb>
<Thumb Style="{StaticResource UnifiedSliderThumbStyle}"/>
</Track.Thumb>
<Track.IncreaseRepeatButton>
<RepeatButton Command="{x:Static Slider.IncreaseLarge}" CommandTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}"
Height="5" BorderThickness="0" Focusable="False">
<RepeatButton.Template>
<ControlTemplate TargetType="RepeatButton">
<Border Background="{DynamicResource ToolAccentSoftBrush}" CornerRadius="3"/>
</ControlTemplate>
</RepeatButton.Template>
</RepeatButton>
</Track.IncreaseRepeatButton>
</Track>
</Grid>
</ControlTemplate>
<ControlTemplate x:Key="UnifiedVerticalSliderTemplate" TargetType="Slider">
<Grid Width="24" Background="Transparent">
<Track x:Name="PART_Track" HorizontalAlignment="Center" IsDirectionReversed="True">
<Track.DecreaseRepeatButton>
<RepeatButton Command="{x:Static Slider.DecreaseLarge}" CommandTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}"
Width="5" BorderThickness="0" Focusable="False">
<RepeatButton.Template>
<ControlTemplate TargetType="RepeatButton">
<Border Background="{DynamicResource MainColor}" CornerRadius="3"/>
</ControlTemplate>
</RepeatButton.Template>
</RepeatButton>
</Track.DecreaseRepeatButton>
<Track.Thumb>
<Thumb Style="{StaticResource UnifiedSliderThumbStyle}"/>
</Track.Thumb>
<Track.IncreaseRepeatButton>
<RepeatButton Command="{x:Static Slider.IncreaseLarge}" CommandTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}"
Width="5" BorderThickness="0" Focusable="False">
<RepeatButton.Template>
<ControlTemplate TargetType="RepeatButton">
<Border Background="{DynamicResource ToolAccentSoftBrush}" CornerRadius="3"/>
</ControlTemplate>
</RepeatButton.Template>
</RepeatButton>
</Track.IncreaseRepeatButton>
</Track>
</Grid>
</ControlTemplate>
<Style x:Key="UnifiedSliderStyle" TargetType="Slider">
<Setter Property="MinWidth" Value="100"/>
<Setter Property="Height" Value="24"/>
<Setter Property="Cursor" Value="Hand"/>
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
<Setter Property="Template" Value="{StaticResource UnifiedHorizontalSliderTemplate}"/>
<Style.Triggers>
<Trigger Property="Orientation" Value="Vertical">
<Setter Property="MinWidth" Value="24"/>
<Setter Property="Width" Value="24"/>
<Setter Property="Height" Value="Auto"/>
<Setter Property="MinHeight" Value="100"/>
<Setter Property="Template" Value="{StaticResource UnifiedVerticalSliderTemplate}"/>
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Opacity" Value="0.48"/>
<Setter Property="Cursor" Value="Arrow"/>
</Trigger>
</Style.Triggers>
</Style>
<Style TargetType="Slider" BasedOn="{StaticResource UnifiedSliderStyle}"/>
<!-- ColorPicker。 -->
<Style x:Key="ColorPickerSwatchItemStyle" TargetType="ListBoxItem">
<Setter Property="Width" Value="34"/>
<Setter Property="Height" Value="34"/>
<Setter Property="Margin" Value="3"/>
<Setter Property="Padding" Value="0"/>
<Setter Property="Cursor" Value="Hand"/>
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ListBoxItem">
<Grid ToolTip="{Binding Name}">
<Ellipse x:Name="SelectionRing" Fill="Transparent" Stroke="Transparent" StrokeThickness="2"/>
<Ellipse Margin="4" Fill="{Binding Brush}" Stroke="#26000000" StrokeThickness="1"/>
<Path x:Name="SelectedMark" Width="11" Height="8" Data="M 1,4 L 4,7 L 10,1"
Stretch="Fill" Stroke="White" StrokeThickness="2"
StrokeStartLineCap="Round" StrokeEndLineCap="Round" Visibility="Collapsed"/>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="SelectionRing" Property="Fill" Value="{DynamicResource ToolAccentSoftBrush}"/>
</Trigger>
<Trigger Property="IsSelected" Value="True">
<Setter TargetName="SelectionRing" Property="Stroke" Value="{DynamicResource MainColor}"/>
<Setter TargetName="SelectedMark" Property="Visibility" Value="Visible"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="controls:ColorPicker">
<Setter Property="MinWidth" Value="150"/>
<Setter Property="Height" Value="38"/>
<Setter Property="Foreground" Value="{DynamicResource ToolTextPrimaryBrush}"/>
<Setter Property="Background" Value="{DynamicResource ToolControlBackgroundBrush}"/>
<Setter Property="BorderBrush" Value="{DynamicResource ToolControlBorderBrush}"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="controls:ColorPicker">
<Grid x:Name="Root">
<ToggleButton Style="{x:Null}" Focusable="False"
IsChecked="{Binding IsDropDownOpen, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}">
<ToggleButton.Template>
<ControlTemplate TargetType="ToggleButton">
<Border x:Name="PickerSurface"
Background="{Binding Background, RelativeSource={RelativeSource AncestorType=controls:ColorPicker}}"
BorderBrush="{Binding BorderBrush, RelativeSource={RelativeSource AncestorType=controls:ColorPicker}}"
BorderThickness="{Binding BorderThickness, RelativeSource={RelativeSource AncestorType=controls:ColorPicker}}"
CornerRadius="11">
<Grid Margin="11,0,9,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="24"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="18"/>
</Grid.ColumnDefinitions>
<Ellipse Width="20" Height="20" Fill="{Binding SelectedBrush, RelativeSource={RelativeSource AncestorType=controls:ColorPicker}}"
Stroke="#26000000" StrokeThickness="1"/>
<TextBlock Grid.Column="1" Margin="8,0" Text="{Binding HexValue, RelativeSource={RelativeSource AncestorType=controls:ColorPicker}}"
Foreground="{Binding Foreground, RelativeSource={RelativeSource AncestorType=controls:ColorPicker}}"
FontFamily="Consolas" VerticalAlignment="Center"/>
<Path x:Name="Arrow" Grid.Column="2" Width="8" Height="5" Data="M 0,0 L 4,4 L 8,0 Z"
Stretch="Fill" Fill="{DynamicResource MainColor}"/>
</Grid>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="PickerSurface" Property="BorderBrush" Value="{DynamicResource ToolControlHoverBorderBrush}"/>
</Trigger>
<Trigger Property="IsChecked" Value="True">
<Setter TargetName="PickerSurface" Property="BorderBrush" Value="{DynamicResource MainColor}"/>
<Setter TargetName="Arrow" Property="RenderTransformOrigin" Value="0.5,0.5"/>
<Setter TargetName="Arrow" Property="RenderTransform"><Setter.Value><RotateTransform Angle="180"/></Setter.Value></Setter>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</ToggleButton.Template>
</ToggleButton>
<Popup x:Name="PART_TimePopup" Placement="Bottom" IsOpen="{Binding IsDropDownOpen, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"
StaysOpen="False" AllowsTransparency="True" PopupAnimation="Fade">
<Border Width="286" Margin="0,6,0,0" Padding="14"
Background="{DynamicResource ToolSurfaceBrush}"
BorderBrush="{DynamicResource ToolControlBorderBrush}" BorderThickness="1" CornerRadius="15">
<Border.Effect><DropShadowEffect Color="#514D74" BlurRadius="22" ShadowDepth="6" Opacity="0.2"/></Border.Effect>
<StackPanel>
<Grid Margin="2,0,2,9">
<Grid.ColumnDefinitions><ColumnDefinition Width="*"/><ColumnDefinition Width="Auto"/></Grid.ColumnDefinitions>
<TextBlock Text="选择颜色" Foreground="{DynamicResource ToolTextPrimaryBrush}" FontWeight="SemiBold"/>
<TextBlock Grid.Column="1" Text="{Binding SelectedColor.A, RelativeSource={RelativeSource TemplatedParent}, StringFormat=透明度 {0}}"
Foreground="{DynamicResource ToolTextSecondaryBrush}" FontSize="9"/>
</Grid>
<ListBox ItemsSource="{Binding Palette, RelativeSource={RelativeSource TemplatedParent}}"
SelectedValuePath="Color"
SelectedValue="{Binding SelectedColor, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"
ItemContainerStyle="{StaticResource ColorPickerSwatchItemStyle}"
Background="Transparent" BorderThickness="0" Padding="0" ScrollViewer.HorizontalScrollBarVisibility="Disabled">
<ListBox.ItemsPanel>
<ItemsPanelTemplate><WrapPanel/></ItemsPanelTemplate>
</ListBox.ItemsPanel>
</ListBox>
<Border Height="1" Margin="2,10" Background="{DynamicResource ToolDividerBrush}"/>
<Grid Margin="2,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="18"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="34"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="28"/><RowDefinition Height="28"/><RowDefinition Height="28"/>
</Grid.RowDefinitions>
<TextBlock Text="R" Foreground="#D1627E" FontWeight="SemiBold" VerticalAlignment="Center"/>
<Slider Grid.Column="1" Margin="5,0" Minimum="0" Maximum="255"
Value="{Binding Red, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"/>
<TextBlock Grid.Column="2" Text="{Binding Red, RelativeSource={RelativeSource TemplatedParent}, StringFormat={}{0:0}}"
Foreground="{DynamicResource ToolTextSecondaryBrush}" TextAlignment="Right" VerticalAlignment="Center"/>
<TextBlock Grid.Row="1" Text="G" Foreground="#4FAE79" FontWeight="SemiBold" VerticalAlignment="Center"/>
<Slider Grid.Row="1" Grid.Column="1" Margin="5,0" Minimum="0" Maximum="255"
Value="{Binding Green, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"/>
<TextBlock Grid.Row="1" Grid.Column="2" Text="{Binding Green, RelativeSource={RelativeSource TemplatedParent}, StringFormat={}{0:0}}"
Foreground="{DynamicResource ToolTextSecondaryBrush}" TextAlignment="Right" VerticalAlignment="Center"/>
<TextBlock Grid.Row="2" Text="B" Foreground="#5D9BEC" FontWeight="SemiBold" VerticalAlignment="Center"/>
<Slider Grid.Row="2" Grid.Column="1" Margin="5,0" Minimum="0" Maximum="255"
Value="{Binding Blue, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"/>
<TextBlock Grid.Row="2" Grid.Column="2" Text="{Binding Blue, RelativeSource={RelativeSource TemplatedParent}, StringFormat={}{0:0}}"
Foreground="{DynamicResource ToolTextSecondaryBrush}" TextAlignment="Right" VerticalAlignment="Center"/>
</Grid>
<TextBox Margin="2,9,2,0" Text="{Binding HexValue, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay, UpdateSourceTrigger=LostFocus}"
FontFamily="Consolas" HorizontalContentAlignment="Center" ToolTip="输入 #RRGGBB 或 #AARRGGBB"/>
</StackPanel>
</Border>
</Popup>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsEnabled" Value="False"><Setter Property="Opacity" Value="0.5"/></Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- DatePicker / CalendarPicker。 -->
<Style x:Key="UnifiedCalendarDayButtonStyle" TargetType="CalendarDayButton">
<Setter Property="MinWidth" Value="30"/>
<Setter Property="MinHeight" Value="28"/>
<Setter Property="Margin" Value="1"/>
<Setter Property="Foreground" Value="{DynamicResource ToolTextPrimaryBrush}"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Cursor" Value="Hand"/>
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="CalendarDayButton">
<Border x:Name="DaySurface" Background="{TemplateBinding Background}" CornerRadius="8">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True"><Setter TargetName="DaySurface" Property="Background" Value="{DynamicResource ToolControlHoverBrush}"/></Trigger>
<Trigger Property="IsToday" Value="True"><Setter TargetName="DaySurface" Property="BorderBrush" Value="{DynamicResource MainColor}"/><Setter TargetName="DaySurface" Property="BorderThickness" Value="1"/></Trigger>
<Trigger Property="IsSelected" Value="True"><Setter TargetName="DaySurface" Property="Background" Value="{DynamicResource MainColor}"/><Setter Property="Foreground" Value="White"/><Setter Property="FontWeight" Value="SemiBold"/></Trigger>
<Trigger Property="IsInactive" Value="True"><Setter Property="Opacity" Value="0.38"/></Trigger>
<Trigger Property="IsBlackedOut" Value="True"><Setter Property="Opacity" Value="0.28"/><Setter Property="TextBlock.TextDecorations" Value="Strikethrough"/></Trigger>
<Trigger Property="IsEnabled" Value="False"><Setter Property="Opacity" Value="0.25"/></Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="UnifiedCalendarButtonStyle" TargetType="CalendarButton">
<Setter Property="MinWidth" Value="58"/>
<Setter Property="MinHeight" Value="38"/>
<Setter Property="Margin" Value="2"/>
<Setter Property="Foreground" Value="{DynamicResource ToolTextPrimaryBrush}"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Cursor" Value="Hand"/>
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="CalendarButton">
<Border x:Name="MonthSurface" Padding="6" Background="{TemplateBinding Background}" CornerRadius="9">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True"><Setter TargetName="MonthSurface" Property="Background" Value="{DynamicResource ToolControlHoverBrush}"/></Trigger>
<Trigger Property="IsFocused" Value="True"><Setter TargetName="MonthSurface" Property="BorderBrush" Value="{DynamicResource MainColor}"/><Setter TargetName="MonthSurface" Property="BorderThickness" Value="1"/></Trigger>
<Trigger Property="IsEnabled" Value="False"><Setter Property="Opacity" Value="0.35"/></Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="UnifiedCalendarStyle" TargetType="Calendar">
<Setter Property="Background" Value="{DynamicResource ToolSurfaceBrush}"/>
<Setter Property="Foreground" Value="{DynamicResource ToolTextPrimaryBrush}"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="CalendarDayButtonStyle" Value="{StaticResource UnifiedCalendarDayButtonStyle}"/>
<Setter Property="CalendarButtonStyle" Value="{StaticResource UnifiedCalendarButtonStyle}"/>
</Style>
<Style TargetType="Calendar" BasedOn="{StaticResource UnifiedCalendarStyle}"/>
<Style x:Key="UnifiedDatePickerTextBoxStyle" TargetType="DatePickerTextBox">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="Foreground" Value="{DynamicResource ToolTextPrimaryBrush}"/>
<Setter Property="CaretBrush" Value="{DynamicResource MainColor}"/>
<Setter Property="SelectionBrush" Value="{DynamicResource MainColor}"/>
<Setter Property="Padding" Value="11,0"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="DatePickerTextBox">
<Grid Background="Transparent">
<ScrollViewer x:Name="PART_ContentHost" Margin="{TemplateBinding Padding}"
VerticalAlignment="Center" Focusable="False"/>
<ContentControl x:Name="PART_Watermark" Margin="{TemplateBinding Padding}"
Foreground="{DynamicResource ToolTextDisabledBrush}"
VerticalAlignment="Center" Focusable="False" IsHitTestVisible="False"
Visibility="Collapsed">
<TextBlock Text="{Binding PlaceholderText, RelativeSource={RelativeSource AncestorType=controls:CalendarPicker},
FallbackValue=选择日期, TargetNullValue=选择日期}"
Foreground="{DynamicResource ToolTextDisabledBrush}"/>
</ContentControl>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="Text" Value="">
<Setter TargetName="PART_Watermark" Property="Visibility" Value="Visible"/>
</Trigger>
<Trigger Property="Text" Value="{x:Null}">
<Setter TargetName="PART_Watermark" Property="Visibility" Value="Visible"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="UnifiedDatePickerStyle" TargetType="DatePicker">
<Setter Property="MinWidth" Value="150"/>
<Setter Property="Height" Value="38"/>
<Setter Property="Background" Value="{DynamicResource ToolControlBackgroundBrush}"/>
<Setter Property="Foreground" Value="{DynamicResource ToolTextPrimaryBrush}"/>
<Setter Property="BorderBrush" Value="{DynamicResource ToolControlBorderBrush}"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="CalendarStyle" Value="{StaticResource UnifiedCalendarStyle}"/>
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="DatePicker">
<Grid x:Name="Root">
<Border x:Name="DateSurface" Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="11">
<Grid>
<Grid.ColumnDefinitions><ColumnDefinition Width="*"/><ColumnDefinition Width="36"/></Grid.ColumnDefinitions>
<DatePickerTextBox x:Name="PART_TextBox" Style="{StaticResource UnifiedDatePickerTextBoxStyle}"/>
<Button x:Name="PART_Button" Grid.Column="1" Style="{x:Null}" Focusable="False">
<Button.Template>
<ControlTemplate TargetType="Button">
<Border x:Name="CalendarButtonSurface" Background="Transparent" CornerRadius="9" Margin="3">
<Grid Width="16" Height="16">
<Border Margin="1,2,1,1" BorderBrush="{DynamicResource MainColor}" BorderThickness="1.5" CornerRadius="2"/>
<Border Height="4" Margin="1,2,1,0" VerticalAlignment="Top" Background="{DynamicResource MainColor}" CornerRadius="2,2,0,0"/>
<Path Data="M 5,0 L 5,4 M 11,0 L 11,4" Stroke="{DynamicResource MainColor}" StrokeThickness="1.5"/>
</Grid>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True"><Setter TargetName="CalendarButtonSurface" Property="Background" Value="{DynamicResource ToolControlHoverBrush}"/></Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Button.Template>
</Button>
</Grid>
</Border>
<Popup x:Name="PART_Popup" Placement="Bottom" IsOpen="{TemplateBinding IsDropDownOpen}"
AllowsTransparency="True" Focusable="False" PopupAnimation="Fade">
<Border Margin="0,6,0,0" Padding="8" Background="{DynamicResource ToolSurfaceBrush}"
BorderBrush="{DynamicResource ToolControlBorderBrush}" BorderThickness="1" CornerRadius="15">
<Border.Effect><DropShadowEffect Color="#514D74" BlurRadius="22" ShadowDepth="6" Opacity="0.2"/></Border.Effect>
<Calendar x:Name="PART_Calendar" Style="{StaticResource UnifiedCalendarStyle}"/>
</Border>
</Popup>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsKeyboardFocusWithin" Value="True"><Setter TargetName="DateSurface" Property="BorderBrush" Value="{DynamicResource MainColor}"/><Setter TargetName="DateSurface" Property="BorderThickness" Value="1.5"/></Trigger>
<Trigger Property="IsMouseOver" Value="True"><Setter TargetName="DateSurface" Property="BorderBrush" Value="{DynamicResource ToolControlHoverBorderBrush}"/></Trigger>
<Trigger Property="IsEnabled" Value="False"><Setter Property="Opacity" Value="0.5"/></Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="DatePicker" BasedOn="{StaticResource UnifiedDatePickerStyle}"/>
<Style TargetType="controls:CalendarPicker" BasedOn="{StaticResource UnifiedDatePickerStyle}"/>
<!-- TimePicker。 -->
<Style x:Key="TimePickerListItemStyle" TargetType="ListBoxItem">
<Setter Property="Width" Value="60"/>
<Setter Property="Height" Value="34"/>
<Setter Property="Margin" Value="2"/>
<Setter Property="Foreground" Value="{DynamicResource ToolTextPrimaryBrush}"/>
<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="Cursor" Value="Hand"/>
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ListBoxItem">
<Border x:Name="TimeSurface" Background="Transparent" CornerRadius="9">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True"><Setter TargetName="TimeSurface" Property="Background" Value="{DynamicResource ToolControlHoverBrush}"/></Trigger>
<Trigger Property="IsSelected" Value="True"><Setter TargetName="TimeSurface" Property="Background" Value="{DynamicResource ToolAccentSelectedBrush}"/><Setter Property="Foreground" Value="{DynamicResource MainColor}"/><Setter Property="FontWeight" Value="SemiBold"/></Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="TimePickerListStyle" TargetType="ListBox">
<Setter Property="Width" Value="80"/>
<Setter Property="Height" Value="180"/>
<Setter Property="Padding" Value="3,3,1,8"/>
<Setter Property="Margin" Value="0,0,0,3"/>
<Setter Property="Background" Value="{DynamicResource ToolControlBackgroundBrush}"/>
<Setter Property="Foreground" Value="{DynamicResource ToolTextPrimaryBrush}"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="ItemContainerStyle" Value="{StaticResource TimePickerListItemStyle}"/>
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled"/>
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
<Setter Property="ScrollViewer.CanContentScroll" Value="False"/>
<Setter Property="VirtualizingPanel.IsVirtualizing" Value="False"/>
</Style>
<Style TargetType="controls:TimePicker">
<Setter Property="MinWidth" Value="142"/>
<Setter Property="Height" Value="38"/>
<Setter Property="Foreground" Value="{DynamicResource ToolTextPrimaryBrush}"/>
<Setter Property="Background" Value="{DynamicResource ToolControlBackgroundBrush}"/>
<Setter Property="BorderBrush" Value="{DynamicResource ToolControlBorderBrush}"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="controls:TimePicker">
<Grid x:Name="Root">
<ToggleButton Style="{x:Null}" Focusable="False"
IsChecked="{Binding IsDropDownOpen, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}">
<ToggleButton.Template>
<ControlTemplate TargetType="ToggleButton">
<Border x:Name="TimePickerSurface"
Background="{Binding Background, RelativeSource={RelativeSource AncestorType=controls:TimePicker}}"
BorderBrush="{Binding BorderBrush, RelativeSource={RelativeSource AncestorType=controls:TimePicker}}"
BorderThickness="{Binding BorderThickness, RelativeSource={RelativeSource AncestorType=controls:TimePicker}}"
CornerRadius="11">
<Grid Margin="11,0,9,0">
<Grid.ColumnDefinitions><ColumnDefinition Width="24"/><ColumnDefinition Width="*"/><ColumnDefinition Width="18"/></Grid.ColumnDefinitions>
<Grid Width="18" Height="18">
<Ellipse Stroke="{DynamicResource MainColor}" StrokeThickness="1.5"/>
<Path Data="M 9,4 L 9,9 L 13,11" Stroke="{DynamicResource MainColor}" StrokeThickness="1.5"
StrokeStartLineCap="Round" StrokeEndLineCap="Round"/>
</Grid>
<TextBlock Grid.Column="1" Margin="8,0" Text="{Binding DisplayText, RelativeSource={RelativeSource AncestorType=controls:TimePicker}}"
Foreground="{Binding Foreground, RelativeSource={RelativeSource AncestorType=controls:TimePicker}}"
VerticalAlignment="Center"/>
<Path x:Name="Arrow" Grid.Column="2" Width="8" Height="5" Data="M 0,0 L 4,4 L 8,0 Z" Stretch="Fill" Fill="{DynamicResource MainColor}"/>
</Grid>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True"><Setter TargetName="TimePickerSurface" Property="BorderBrush" Value="{DynamicResource ToolControlHoverBorderBrush}"/></Trigger>
<Trigger Property="IsChecked" Value="True"><Setter TargetName="TimePickerSurface" Property="BorderBrush" Value="{DynamicResource MainColor}"/><Setter TargetName="Arrow" Property="RenderTransformOrigin" Value="0.5,0.5"/><Setter TargetName="Arrow" Property="RenderTransform"><Setter.Value><RotateTransform Angle="180"/></Setter.Value></Setter></Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</ToggleButton.Template>
</ToggleButton>
<Popup Placement="Bottom" IsOpen="{Binding IsDropDownOpen, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"
StaysOpen="False" AllowsTransparency="True" PopupAnimation="Fade">
<Border Width="308" Margin="0,6,0,0" Padding="12" Background="{DynamicResource ToolSurfaceBrush}"
BorderBrush="{DynamicResource ToolControlBorderBrush}" BorderThickness="1" CornerRadius="15">
<Border.Effect><DropShadowEffect Color="#514D74" BlurRadius="22" ShadowDepth="6" Opacity="0.2"/></Border.Effect>
<Grid>
<Grid.RowDefinitions><RowDefinition Height="Auto"/><RowDefinition Height="Auto"/></Grid.RowDefinitions>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
<StackPanel Width="80" Visibility="{Binding ShowHour, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource TimePickerBooleanToVisibilityConverter}}">
<TextBlock Text="小时" Margin="0,0,0,8" Foreground="{DynamicResource ToolTextSecondaryBrush}" FontSize="9.5" HorizontalAlignment="Center"/>
<ListBox x:Name="PART_HourList" Style="{StaticResource TimePickerListStyle}"
ItemsSource="{Binding Hours, RelativeSource={RelativeSource TemplatedParent}}"
SelectedItem="{Binding Hour, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"/>
</StackPanel>
<TextBlock Text=":" Width="16" Foreground="{DynamicResource MainColor}" FontSize="18" FontWeight="Bold"
HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Visibility" Value="Collapsed"/>
<Style.Triggers>
<MultiDataTrigger>
<MultiDataTrigger.Conditions>
<Condition Binding="{Binding ShowHour, RelativeSource={RelativeSource TemplatedParent}}" Value="True"/>
<Condition Binding="{Binding ShowMinute, RelativeSource={RelativeSource TemplatedParent}}" Value="True"/>
</MultiDataTrigger.Conditions>
<Setter Property="Visibility" Value="Visible"/>
</MultiDataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
<StackPanel Width="80" Visibility="{Binding ShowMinute, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource TimePickerBooleanToVisibilityConverter}}">
<TextBlock Text="分钟" Margin="0,0,0,8" Foreground="{DynamicResource ToolTextSecondaryBrush}" FontSize="9.5" HorizontalAlignment="Center"/>
<ListBox x:Name="PART_MinuteList" Style="{StaticResource TimePickerListStyle}"
ItemsSource="{Binding Minutes, RelativeSource={RelativeSource TemplatedParent}}"
SelectedItem="{Binding Minute, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"/>
</StackPanel>
<TextBlock Text=":" Width="16" Foreground="{DynamicResource MainColor}" FontSize="18" FontWeight="Bold"
HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Visibility" Value="Collapsed"/>
<Style.Triggers>
<MultiDataTrigger>
<MultiDataTrigger.Conditions>
<Condition Binding="{Binding ShowHour, RelativeSource={RelativeSource TemplatedParent}}" Value="True"/>
<Condition Binding="{Binding ShowSecond, RelativeSource={RelativeSource TemplatedParent}}" Value="True"/>
</MultiDataTrigger.Conditions>
<Setter Property="Visibility" Value="Visible"/>
</MultiDataTrigger>
<MultiDataTrigger>
<MultiDataTrigger.Conditions>
<Condition Binding="{Binding ShowMinute, RelativeSource={RelativeSource TemplatedParent}}" Value="True"/>
<Condition Binding="{Binding ShowSecond, RelativeSource={RelativeSource TemplatedParent}}" Value="True"/>
</MultiDataTrigger.Conditions>
<Setter Property="Visibility" Value="Visible"/>
</MultiDataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
<StackPanel Width="80" Visibility="{Binding ShowSecond, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource TimePickerBooleanToVisibilityConverter}}">
<TextBlock Text="秒钟" Margin="0,0,0,8" Foreground="{DynamicResource ToolTextSecondaryBrush}" FontSize="9.5" HorizontalAlignment="Center"/>
<ListBox x:Name="PART_SecondList" Style="{StaticResource TimePickerListStyle}"
ItemsSource="{Binding Seconds, RelativeSource={RelativeSource TemplatedParent}}"
SelectedItem="{Binding Second, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"/>
</StackPanel>
</StackPanel>
<Grid Grid.Row="1" Margin="0,10,0,0">
<Grid.ColumnDefinitions><ColumnDefinition Width="*"/><ColumnDefinition Width="6"/><ColumnDefinition Width="*"/><ColumnDefinition Width="6"/><ColumnDefinition Width="*"/></Grid.ColumnDefinitions>
<Button Content="现在" Height="32" MinWidth="0" Padding="7,0"
Command="{x:Static controls:TimePicker.SelectNowCommand}"
CommandTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}"/>
<Button Grid.Column="2" Content="清除" Height="32" MinWidth="0" Padding="7,0"
Command="{x:Static controls:TimePicker.ClearTimeCommand}"
CommandTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}"/>
<Button Grid.Column="4" Content="完成" Height="32" MinWidth="0" Padding="7,0"
controls:ButtonAssist.IsPrimary="True"
Command="{x:Static controls:TimePicker.ConfirmTimeCommand}"
CommandTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}"/>
</Grid>
</Grid>
</Border>
</Popup>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsEnabled" Value="False"><Setter Property="Opacity" Value="0.5"/></Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>