786 lines
45 KiB
XML
786 lines
45 KiB
XML
<ResourceDictionary
|
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
xmlns:assists="clr-namespace:Melskin.Assists"
|
|
xmlns:controls="clr-namespace:Melskin.Controls"
|
|
xmlns:decorations="clr-namespace:Melskin.Controls.Decorations"
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
|
<ResourceDictionary.MergedDictionaries>
|
|
<ResourceDictionary Source="/Melskin;component/Controls/IconElement.xaml" />
|
|
<ResourceDictionary Source="/Melskin;component/Themes/Animations.xaml" />
|
|
</ResourceDictionary.MergedDictionaries>
|
|
<!-- Float为凹陷和凸起切换的交互 -->
|
|
<Style TargetType="{x:Type TextBox}" x:Key="FloatTextBoxStyle">
|
|
<Setter Property="Background" Value="{DynamicResource ControlBackgroundNormalBrush}" />
|
|
<Setter Property="BorderBrush" Value="Transparent" />
|
|
<Setter Property="SnapsToDevicePixels" Value="True" />
|
|
<Setter Property="Foreground" Value="{DynamicResource TextPrimaryBrush}" />
|
|
<Setter Property="BorderThickness" Value="1" />
|
|
<Setter Property="FontSize" Value="14" />
|
|
<Setter Property="Padding" Value="10,4" />
|
|
<Setter Property="KeyboardNavigation.TabNavigation" Value="None" />
|
|
<Setter Property="HorizontalContentAlignment" Value="Left" />
|
|
<Setter Property="VerticalContentAlignment" Value="Center" />
|
|
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
|
|
<Setter Property="AllowDrop" Value="True" />
|
|
<Setter Property="ScrollViewer.PanningMode" Value="VerticalFirst" />
|
|
<Setter Property="Stylus.IsFlicksEnabled" Value="False" />
|
|
<Setter Property="ContextMenu" Value="{DynamicResource TextBoxContextMenu}" />
|
|
<Setter Property="Validation.ErrorTemplate">
|
|
<Setter.Value>
|
|
<ControlTemplate>
|
|
<StackPanel>
|
|
<AdornedElementPlaceholder Name="Adorner" />
|
|
<TextBlock
|
|
Foreground="{DynamicResource ErrorBrush}"
|
|
HorizontalAlignment="Right"
|
|
Text="{Binding ElementName=Adorner, Path=AdornedElement.(Validation.Errors)[0].ErrorContent}" />
|
|
</StackPanel>
|
|
</ControlTemplate>
|
|
</Setter.Value>
|
|
</Setter>
|
|
<Setter Property="Template">
|
|
<Setter.Value>
|
|
<ControlTemplate TargetType="{x:Type TextBox}">
|
|
<Grid>
|
|
<decorations:SlotBorder
|
|
Background="{TemplateBinding Background}"
|
|
BorderBrush="{TemplateBinding BorderBrush}"
|
|
BorderThickness="{TemplateBinding BorderThickness}"
|
|
Intensity="0.2"
|
|
Margin="-4"
|
|
SnapsToDevicePixels="True"
|
|
x:Name="slot" />
|
|
<decorations:EmbossBorder
|
|
Background="{TemplateBinding Background}"
|
|
BorderBrush="{TemplateBinding BorderBrush}"
|
|
BorderThickness="{TemplateBinding BorderThickness}"
|
|
Intensity="0.4"
|
|
Margin="-4"
|
|
SnapsToDevicePixels="True"
|
|
Visibility="Collapsed"
|
|
x:Name="emboss" />
|
|
<Grid>
|
|
<Grid.ColumnDefinitions>
|
|
<!-- 前缀 -->
|
|
<ColumnDefinition Width="Auto" />
|
|
<!-- 输入框 -->
|
|
<ColumnDefinition Width="*" />
|
|
<!-- 清空按钮 -->
|
|
<ColumnDefinition Width="Auto" />
|
|
<!-- 后缀 -->
|
|
<ColumnDefinition Width="Auto" />
|
|
</Grid.ColumnDefinitions>
|
|
<ContentPresenter
|
|
Content="{TemplateBinding assists:InputAssist.Prefix}"
|
|
Focusable="False"
|
|
Grid.Column="0"
|
|
Margin="1,0,5,0"
|
|
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
|
x:Name="Prefix" />
|
|
<!-- 水印 -->
|
|
<TextBlock
|
|
Focusable="False"
|
|
Foreground="{DynamicResource TextPlaceholderBrush}"
|
|
Grid.Column="1"
|
|
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
|
Margin="5,0,0,0"
|
|
Text="{TemplateBinding assists:InputAssist.PlaceholderText}"
|
|
TextAlignment="{TemplateBinding TextAlignment}"
|
|
TextWrapping="{TemplateBinding TextWrapping}"
|
|
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
|
Visibility="Collapsed"
|
|
x:Name="Placeholder" />
|
|
<!-- Margin="{Binding Padding, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}, Converter={x:Static converters:ThicknessReverseConverter.Instance}}" -->
|
|
<ScrollViewer
|
|
Background="{x:Null}"
|
|
BorderThickness="0"
|
|
Focusable="False"
|
|
Grid.Column="1"
|
|
HorizontalScrollBarVisibility="Hidden"
|
|
IsTabStop="False"
|
|
Padding="{TemplateBinding Padding}"
|
|
VerticalScrollBarVisibility="Hidden"
|
|
x:Name="PART_ContentHost" />
|
|
<!-- 清空按钮 -->
|
|
<controls:IconElement
|
|
Grid.Column="2"
|
|
Style="{StaticResource ToolIcon}"
|
|
Symbol="Close"
|
|
Visibility="Collapsed"
|
|
x:Name="CloseIcon" />
|
|
|
|
<!-- Suffix -->
|
|
<ContentPresenter
|
|
Content="{TemplateBinding assists:InputAssist.Suffix}"
|
|
Focusable="False"
|
|
Grid.Column="3"
|
|
Margin="5,0,1,0"
|
|
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
|
x:Name="Suffix" />
|
|
</Grid>
|
|
</Grid>
|
|
<ControlTemplate.Triggers>
|
|
<DataTrigger Binding="{Binding Text, Mode=OneWay, RelativeSource={RelativeSource Self}}" Value="">
|
|
<Setter Property="Visibility" TargetName="Placeholder" Value="Visible" />
|
|
</DataTrigger>
|
|
<!-- Prefix & Suffix -->
|
|
<Trigger Property="Content" SourceName="Prefix" Value="{x:Null}">
|
|
<Setter Property="Visibility" TargetName="Prefix" Value="Collapsed" />
|
|
</Trigger>
|
|
<Trigger Property="Content" SourceName="Suffix" Value="{x:Null}">
|
|
<Setter Property="Visibility" TargetName="Suffix" Value="Collapsed" />
|
|
</Trigger>
|
|
|
|
<MultiTrigger>
|
|
<!-- 可清空 -->
|
|
<MultiTrigger.Conditions>
|
|
<Condition Property="assists:InputAssist.Clearable" Value="True" />
|
|
<Condition Property="Visibility" SourceName="Placeholder" Value="Collapsed" />
|
|
</MultiTrigger.Conditions>
|
|
<Setter Property="Visibility" TargetName="CloseIcon" Value="Visible" />
|
|
<Setter Property="assists:InputAssist.ClearEnabled" TargetName="CloseIcon" Value="True" />
|
|
</MultiTrigger>
|
|
<Trigger Property="IsEnabled" Value="False">
|
|
<Setter Property="Foreground" Value="{DynamicResource TextDisabledBrush}" />
|
|
<Setter Property="Background" Value="{DynamicResource ControlBackgroundDisabledBrush}" />
|
|
<Setter Property="ShaderEnabled" TargetName="slot" Value="False" />
|
|
</Trigger>
|
|
<Trigger Property="IsReadOnly" Value="True">
|
|
<Setter Property="Foreground" Value="{DynamicResource TextSecondaryBrush}" />
|
|
</Trigger>
|
|
|
|
<Trigger Property="IsFocused" Value="True">
|
|
<Setter Property="TextElement.Foreground" TargetName="Prefix" Value="{DynamicResource PrimaryNormalBrush}" />
|
|
<Setter Property="TextElement.Foreground" TargetName="Suffix" Value="{DynamicResource PrimaryNormalBrush}" />
|
|
<Setter Property="Visibility" TargetName="slot" Value="Collapsed" />
|
|
<Setter Property="Visibility" TargetName="emboss" Value="Visible" />
|
|
</Trigger>
|
|
|
|
<!--<Trigger Property="IsKeyboardFocused" Value="True" />-->
|
|
<MultiTrigger>
|
|
<MultiTrigger.Conditions>
|
|
<Condition Property="IsMouseOver" Value="False" />
|
|
<Condition Property="IsKeyboardFocused" Value="False" />
|
|
</MultiTrigger.Conditions>
|
|
<MultiTrigger.EnterActions>
|
|
<BeginStoryboard Storyboard="{StaticResource TextBox.LeaveEffect}" />
|
|
</MultiTrigger.EnterActions>
|
|
<MultiTrigger.ExitActions>
|
|
<BeginStoryboard Storyboard="{StaticResource TextBox.FocusEffect}" />
|
|
</MultiTrigger.ExitActions>
|
|
</MultiTrigger>
|
|
</ControlTemplate.Triggers>
|
|
</ControlTemplate>
|
|
</Setter.Value>
|
|
</Setter>
|
|
<Style.Triggers>
|
|
<MultiTrigger>
|
|
<MultiTrigger.Conditions>
|
|
<Condition Property="IsInactiveSelectionHighlightEnabled" Value="True" />
|
|
<Condition Property="IsSelectionActive" Value="False" />
|
|
</MultiTrigger.Conditions>
|
|
<Setter Property="SelectionBrush" Value="{DynamicResource {x:Static SystemColors.InactiveSelectionHighlightBrushKey}}" />
|
|
</MultiTrigger>
|
|
</Style.Triggers>
|
|
</Style>
|
|
<Style TargetType="{x:Type TextBox}" x:Key="SlotTextBoxStyle">
|
|
<Setter Property="Background" Value="{DynamicResource ControlBackgroundNormalBrush}" />
|
|
<Setter Property="BorderBrush" Value="Transparent" />
|
|
<Setter Property="assists:InputAssist.PlaceholderText" Value="请输入..." />
|
|
<Setter Property="SnapsToDevicePixels" Value="True" />
|
|
<Setter Property="Foreground" Value="{DynamicResource TextPrimaryBrush}" />
|
|
<Setter Property="BorderThickness" Value="1" />
|
|
<Setter Property="FontSize" Value="14" />
|
|
<Setter Property="Padding" Value="3" />
|
|
<Setter Property="KeyboardNavigation.TabNavigation" Value="None" />
|
|
<Setter Property="HorizontalContentAlignment" Value="Left" />
|
|
<Setter Property="VerticalContentAlignment" Value="Center" />
|
|
<Setter Property="VerticalAlignment" Value="Center" />
|
|
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
|
|
<Setter Property="AllowDrop" Value="True" />
|
|
<Setter Property="ScrollViewer.PanningMode" Value="VerticalFirst" />
|
|
<Setter Property="Stylus.IsFlicksEnabled" Value="False" />
|
|
<Setter Property="ContextMenu" Value="{DynamicResource TextBoxContextMenu}" />
|
|
<Setter Property="Validation.ErrorTemplate">
|
|
<Setter.Value>
|
|
<ControlTemplate>
|
|
<StackPanel>
|
|
<AdornedElementPlaceholder Name="Adorner" />
|
|
<TextBlock
|
|
Foreground="{DynamicResource ErrorBrush}"
|
|
HorizontalAlignment="Right"
|
|
Text="{Binding ElementName=Adorner, Path=AdornedElement.(Validation.Errors)[0].ErrorContent}" />
|
|
</StackPanel>
|
|
</ControlTemplate>
|
|
</Setter.Value>
|
|
</Setter>
|
|
<Setter Property="Template">
|
|
<Setter.Value>
|
|
<ControlTemplate TargetType="{x:Type TextBox}">
|
|
<ControlTemplate.Resources>
|
|
<!-- 聚焦对象 -->
|
|
<Storyboard x:Key="TextBox.FocusEffect">
|
|
<DoubleAnimation
|
|
Duration="0:0:0.2"
|
|
Storyboard.TargetName="slot"
|
|
Storyboard.TargetProperty="Intensity"
|
|
To="0.5" />
|
|
</Storyboard>
|
|
<!-- 取消聚焦对象 -->
|
|
<Storyboard x:Key="TextBox.LeaveEffect">
|
|
<DoubleAnimation
|
|
Duration="0:0:0.2"
|
|
Storyboard.TargetName="slot"
|
|
Storyboard.TargetProperty="Intensity"
|
|
To="0.2" />
|
|
</Storyboard>
|
|
</ControlTemplate.Resources>
|
|
|
|
<decorations:SlotBorder
|
|
Background="{TemplateBinding Background}"
|
|
BorderBrush="{TemplateBinding BorderBrush}"
|
|
BorderThickness="{TemplateBinding BorderThickness}"
|
|
Intensity="0.2"
|
|
SnapsToDevicePixels="True"
|
|
x:Name="slot">
|
|
<Grid>
|
|
<Grid.ColumnDefinitions>
|
|
<!-- 前缀 -->
|
|
<ColumnDefinition Width="Auto" />
|
|
<!-- 输入框 -->
|
|
<ColumnDefinition Width="*" />
|
|
<!-- 清空按钮 -->
|
|
<ColumnDefinition Width="Auto" />
|
|
<!-- 后缀 -->
|
|
<ColumnDefinition Width="Auto" />
|
|
</Grid.ColumnDefinitions>
|
|
<ContentPresenter
|
|
Content="{TemplateBinding assists:InputAssist.Prefix}"
|
|
Focusable="False"
|
|
Grid.Column="0"
|
|
Margin="1,0,5,0"
|
|
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
|
x:Name="Prefix" />
|
|
<!-- 水印 -->
|
|
<TextBlock
|
|
Focusable="False"
|
|
Foreground="{DynamicResource TextPlaceholderBrush}"
|
|
Grid.Column="1"
|
|
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
|
Margin="5,0,0,0"
|
|
Text="{TemplateBinding assists:InputAssist.PlaceholderText}"
|
|
TextAlignment="{TemplateBinding TextAlignment}"
|
|
TextWrapping="{TemplateBinding TextWrapping}"
|
|
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
|
Visibility="Collapsed"
|
|
x:Name="Placeholder" />
|
|
<!-- Margin="{Binding Padding, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}, Converter={x:Static converters:ThicknessReverseConverter.Instance}}" -->
|
|
<ScrollViewer
|
|
Background="{x:Null}"
|
|
BorderThickness="0"
|
|
Focusable="False"
|
|
Grid.Column="1"
|
|
HorizontalScrollBarVisibility="Hidden"
|
|
IsTabStop="False"
|
|
Padding="{TemplateBinding Padding}"
|
|
VerticalScrollBarVisibility="Hidden"
|
|
x:Name="PART_ContentHost" />
|
|
<!-- 清空按钮 -->
|
|
<controls:IconElement
|
|
Grid.Column="2"
|
|
Style="{StaticResource ToolIcon}"
|
|
Symbol="Close"
|
|
Visibility="Collapsed"
|
|
x:Name="CloseIcon" />
|
|
|
|
<!-- Suffix -->
|
|
<ContentPresenter
|
|
Content="{TemplateBinding assists:InputAssist.Suffix}"
|
|
Focusable="False"
|
|
Grid.Column="3"
|
|
Margin="5,0,1,0"
|
|
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
|
x:Name="Suffix" />
|
|
</Grid>
|
|
</decorations:SlotBorder>
|
|
|
|
<ControlTemplate.Triggers>
|
|
<DataTrigger Binding="{Binding Text, Mode=OneWay, RelativeSource={RelativeSource Self}}" Value="">
|
|
<Setter Property="Visibility" TargetName="Placeholder" Value="Visible" />
|
|
</DataTrigger>
|
|
<!-- Prefix & Suffix -->
|
|
<Trigger Property="Content" SourceName="Prefix" Value="{x:Null}">
|
|
<Setter Property="Visibility" TargetName="Prefix" Value="Collapsed" />
|
|
</Trigger>
|
|
<Trigger Property="Content" SourceName="Suffix" Value="{x:Null}">
|
|
<Setter Property="Visibility" TargetName="Suffix" Value="Collapsed" />
|
|
</Trigger>
|
|
|
|
<MultiTrigger>
|
|
<!-- 可清空 -->
|
|
<MultiTrigger.Conditions>
|
|
<Condition Property="assists:InputAssist.Clearable" Value="True" />
|
|
<Condition Property="Visibility" SourceName="Placeholder" Value="Collapsed" />
|
|
</MultiTrigger.Conditions>
|
|
<Setter Property="Visibility" TargetName="CloseIcon" Value="Visible" />
|
|
<Setter Property="assists:InputAssist.ClearEnabled" TargetName="CloseIcon" Value="True" />
|
|
</MultiTrigger>
|
|
<Trigger Property="IsEnabled" Value="False">
|
|
<Setter Property="Foreground" Value="{DynamicResource TextDisabledBrush}" />
|
|
<Setter Property="Background" Value="{DynamicResource ControlBackgroundDisabledBrush}" />
|
|
<Setter Property="ShaderEnabled" TargetName="slot" Value="False" />
|
|
</Trigger>
|
|
<Trigger Property="IsReadOnly" Value="True">
|
|
<Setter Property="Foreground" Value="{DynamicResource TextSecondaryBrush}" />
|
|
</Trigger>
|
|
|
|
<Trigger Property="IsFocused" Value="True">
|
|
<Setter Property="TextElement.Foreground" TargetName="Prefix" Value="{DynamicResource PrimaryNormalBrush}" />
|
|
<Setter Property="TextElement.Foreground" TargetName="Suffix" Value="{DynamicResource PrimaryNormalBrush}" />
|
|
</Trigger>
|
|
|
|
<!--<Trigger Property="IsKeyboardFocused" Value="True" />-->
|
|
<MultiTrigger>
|
|
<MultiTrigger.Conditions>
|
|
<Condition Property="IsMouseOver" Value="False" />
|
|
<Condition Property="IsKeyboardFocused" Value="False" />
|
|
</MultiTrigger.Conditions>
|
|
<MultiTrigger.EnterActions>
|
|
<BeginStoryboard Storyboard="{StaticResource TextBox.LeaveEffect}" />
|
|
</MultiTrigger.EnterActions>
|
|
<MultiTrigger.ExitActions>
|
|
<BeginStoryboard Storyboard="{StaticResource TextBox.FocusEffect}" />
|
|
</MultiTrigger.ExitActions>
|
|
</MultiTrigger>
|
|
|
|
</ControlTemplate.Triggers>
|
|
</ControlTemplate>
|
|
</Setter.Value>
|
|
</Setter>
|
|
<Style.Triggers>
|
|
<MultiTrigger>
|
|
<MultiTrigger.Conditions>
|
|
<Condition Property="IsInactiveSelectionHighlightEnabled" Value="True" />
|
|
<Condition Property="IsSelectionActive" Value="False" />
|
|
</MultiTrigger.Conditions>
|
|
<Setter Property="SelectionBrush" Value="{DynamicResource {x:Static SystemColors.InactiveSelectionHighlightBrushKey}}" />
|
|
</MultiTrigger>
|
|
</Style.Triggers>
|
|
</Style>
|
|
|
|
<Style TargetType="{x:Type TextBox}" x:Key="DefaultTextBoxStyle">
|
|
<Setter Property="Background" Value="{DynamicResource ControlBackgroundNormalBrush}" />
|
|
<Setter Property="BorderBrush" Value="Transparent" />
|
|
<Setter Property="SnapsToDevicePixels" Value="True" />
|
|
<Setter Property="Foreground" Value="{DynamicResource TextPrimaryBrush}" />
|
|
<Setter Property="BorderThickness" Value="1" />
|
|
<Setter Property="FontSize" Value="14" />
|
|
<Setter Property="Padding" Value="4" />
|
|
<Setter Property="KeyboardNavigation.TabNavigation" Value="None" />
|
|
<Setter Property="HorizontalContentAlignment" Value="Left" />
|
|
<Setter Property="VerticalContentAlignment" Value="Center" />
|
|
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
|
|
<Setter Property="AllowDrop" Value="True" />
|
|
<Setter Property="ScrollViewer.PanningMode" Value="VerticalFirst" />
|
|
<Setter Property="Stylus.IsFlicksEnabled" Value="False" />
|
|
<Setter Property="ContextMenu" Value="{DynamicResource TextBoxContextMenu}" />
|
|
<Setter Property="Validation.ErrorTemplate">
|
|
<Setter.Value>
|
|
<ControlTemplate>
|
|
<StackPanel>
|
|
<AdornedElementPlaceholder Name="Adorner" />
|
|
<TextBlock
|
|
Foreground="{DynamicResource ErrorBrush}"
|
|
HorizontalAlignment="Right"
|
|
Text="{Binding ElementName=Adorner, Path=AdornedElement.(Validation.Errors)[0].ErrorContent}" />
|
|
</StackPanel>
|
|
</ControlTemplate>
|
|
</Setter.Value>
|
|
</Setter>
|
|
<Setter Property="Template">
|
|
<Setter.Value>
|
|
<ControlTemplate TargetType="{x:Type TextBox}">
|
|
<Border
|
|
Background="{TemplateBinding Background}"
|
|
BorderBrush="{TemplateBinding BorderBrush}"
|
|
BorderThickness="{TemplateBinding BorderThickness}"
|
|
CornerRadius="{TemplateBinding assists:ControlAssist.CornerRadius}"
|
|
Padding="{TemplateBinding Padding}"
|
|
SnapsToDevicePixels="True"
|
|
x:Name="ContentBorder">
|
|
<Grid>
|
|
<Grid.ColumnDefinitions>
|
|
<!-- 前缀 -->
|
|
<ColumnDefinition Width="Auto" />
|
|
<!-- 输入框 -->
|
|
<ColumnDefinition Width="*" />
|
|
<!-- 清空按钮 -->
|
|
<ColumnDefinition Width="Auto" />
|
|
<!-- 后缀 -->
|
|
<ColumnDefinition Width="Auto" />
|
|
</Grid.ColumnDefinitions>
|
|
<ContentPresenter
|
|
Content="{TemplateBinding assists:InputAssist.Prefix}"
|
|
Focusable="False"
|
|
Grid.Column="0"
|
|
Margin="1,0,5,0"
|
|
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
|
x:Name="Prefix" />
|
|
<!-- 水印 -->
|
|
<TextBlock
|
|
Focusable="False"
|
|
Foreground="{DynamicResource TextPlaceholderBrush}"
|
|
Grid.Column="1"
|
|
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
|
Margin="5,0,0,0"
|
|
Text="{TemplateBinding assists:InputAssist.PlaceholderText}"
|
|
TextAlignment="{TemplateBinding TextAlignment}"
|
|
TextWrapping="{TemplateBinding TextWrapping}"
|
|
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
|
Visibility="Collapsed"
|
|
x:Name="Placeholder" />
|
|
<!-- Margin="{Binding Padding, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}, Converter={x:Static converters:ThicknessReverseConverter.Instance}}" -->
|
|
<ScrollViewer
|
|
Background="{x:Null}"
|
|
BorderThickness="0"
|
|
Focusable="False"
|
|
Grid.Column="1"
|
|
HorizontalScrollBarVisibility="Hidden"
|
|
IsTabStop="False"
|
|
VerticalScrollBarVisibility="Hidden"
|
|
x:Name="PART_ContentHost" />
|
|
<!-- 清空按钮 -->
|
|
<controls:IconElement
|
|
Grid.Column="2"
|
|
Style="{StaticResource ToolIcon}"
|
|
Symbol="Close"
|
|
Visibility="Collapsed"
|
|
x:Name="CloseIcon" />
|
|
|
|
<!-- Suffix -->
|
|
<ContentPresenter
|
|
Content="{TemplateBinding assists:InputAssist.Suffix}"
|
|
Focusable="False"
|
|
Grid.Column="3"
|
|
Margin="5,0,1,0"
|
|
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
|
x:Name="Suffix" />
|
|
</Grid>
|
|
</Border>
|
|
|
|
<ControlTemplate.Triggers>
|
|
<DataTrigger Binding="{Binding Text, Mode=OneWay, RelativeSource={RelativeSource Self}}" Value="">
|
|
<Setter Property="Visibility" TargetName="Placeholder" Value="Visible" />
|
|
</DataTrigger>
|
|
<!-- Prefix & Suffix -->
|
|
<Trigger Property="Content" SourceName="Prefix" Value="{x:Null}">
|
|
<Setter Property="Visibility" TargetName="Prefix" Value="Collapsed" />
|
|
</Trigger>
|
|
<Trigger Property="Content" SourceName="Suffix" Value="{x:Null}">
|
|
<Setter Property="Visibility" TargetName="Suffix" Value="Collapsed" />
|
|
</Trigger>
|
|
|
|
<MultiTrigger>
|
|
<!-- 可清空 -->
|
|
<MultiTrigger.Conditions>
|
|
<Condition Property="assists:InputAssist.Clearable" Value="True" />
|
|
<Condition Property="Visibility" SourceName="Placeholder" Value="Collapsed" />
|
|
</MultiTrigger.Conditions>
|
|
<Setter Property="Visibility" TargetName="CloseIcon" Value="Visible" />
|
|
<Setter Property="assists:InputAssist.ClearEnabled" TargetName="CloseIcon" Value="True" />
|
|
</MultiTrigger>
|
|
<Trigger Property="IsEnabled" Value="False">
|
|
<Setter Property="Foreground" Value="{DynamicResource TextDisabledBrush}" />
|
|
<Setter Property="Background" Value="{DynamicResource ControlBackgroundDisabledBrush}" />
|
|
<Setter Property="Cursor" Value="None" />
|
|
</Trigger>
|
|
<Trigger Property="IsReadOnly" Value="True">
|
|
<Setter Property="Foreground" Value="{DynamicResource TextSecondaryBrush}" />
|
|
</Trigger>
|
|
|
|
<Trigger Property="IsFocused" Value="True">
|
|
<Setter Property="TextElement.Foreground" TargetName="Prefix" Value="{DynamicResource PrimaryNormalBrush}" />
|
|
<Setter Property="TextElement.Foreground" TargetName="Suffix" Value="{DynamicResource PrimaryNormalBrush}" />
|
|
<Setter Property="BorderBrush" TargetName="ContentBorder" Value="{DynamicResource PrimaryNormalBrush}" />
|
|
</Trigger>
|
|
<Trigger Property="IsMouseOver" Value="True">
|
|
<Setter Property="Background" TargetName="ContentBorder" Value="{DynamicResource ControlBackgroundHoverBrush}" />
|
|
</Trigger>
|
|
<!--<Trigger Property="IsKeyboardFocused" Value="True" />-->
|
|
|
|
</ControlTemplate.Triggers>
|
|
</ControlTemplate>
|
|
</Setter.Value>
|
|
</Setter>
|
|
<Style.Triggers>
|
|
<MultiTrigger>
|
|
<MultiTrigger.Conditions>
|
|
<Condition Property="IsInactiveSelectionHighlightEnabled" Value="True" />
|
|
<Condition Property="IsSelectionActive" Value="False" />
|
|
</MultiTrigger.Conditions>
|
|
<Setter Property="SelectionBrush" Value="{DynamicResource {x:Static SystemColors.InactiveSelectionHighlightBrushKey}}" />
|
|
</MultiTrigger>
|
|
</Style.Triggers>
|
|
</Style>
|
|
|
|
<!-- 默认文本框样式 -->
|
|
<Style BasedOn="{StaticResource DefaultTextBoxStyle}" TargetType="{x:Type TextBox}" />
|
|
|
|
<!-- 富文本样式 -->
|
|
<Style TargetType="{x:Type RichTextBox}" x:Key="SlotRichTextBoxStyle">
|
|
<Style.Resources>
|
|
<Style TargetType="{x:Type FlowDocument}" x:Key="{x:Type FlowDocument}">
|
|
<Setter Property="OverridesDefaultStyle" Value="True" />
|
|
</Style>
|
|
<Style
|
|
BasedOn="{StaticResource {x:Type Hyperlink}}"
|
|
TargetType="{x:Type Hyperlink}"
|
|
x:Key="{x:Type Hyperlink}">
|
|
<Style.Triggers>
|
|
<Trigger Property="IsMouseOver" Value="True">
|
|
<Setter Property="Foreground" Value="{DynamicResource PrimaryNormalBrush}" />
|
|
</Trigger>
|
|
<Trigger Property="IsEnabled" Value="False">
|
|
<Setter Property="Foreground" Value="{DynamicResource TextDisabledBrush}" />
|
|
</Trigger>
|
|
</Style.Triggers>
|
|
</Style>
|
|
</Style.Resources>
|
|
<Setter Property="Background" Value="{DynamicResource ControlBackgroundNormalBrush}" />
|
|
<Setter Property="BorderBrush" Value="Transparent" />
|
|
<Setter Property="Foreground" Value="{DynamicResource TextPrimaryBrush}" />
|
|
<Setter Property="BorderThickness" Value="1" />
|
|
<Setter Property="FontSize" Value="14" />
|
|
<Setter Property="KeyboardNavigation.TabNavigation" Value="None" />
|
|
<Setter Property="HorizontalContentAlignment" Value="Left" />
|
|
<Setter Property="VerticalContentAlignment" Value="Center" />
|
|
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
|
|
<Setter Property="AllowDrop" Value="True" />
|
|
<Setter Property="ScrollViewer.PanningMode" Value="VerticalFirst" />
|
|
<Setter Property="Stylus.IsFlicksEnabled" Value="False" />
|
|
<Setter Property="ContextMenu" Value="{DynamicResource TextBoxContextMenu}" />
|
|
<Setter Property="VerticalAlignment" Value="Center" />
|
|
<Setter Property="MinWidth" Value="10" />
|
|
<Setter Property="Padding" Value="2,4" />
|
|
<Setter Property="Template">
|
|
<Setter.Value>
|
|
<ControlTemplate TargetType="{x:Type RichTextBox}">
|
|
<ControlTemplate.Resources>
|
|
<!-- 聚焦对象 -->
|
|
<Storyboard x:Key="TextBox.FocusEffect">
|
|
<DoubleAnimation
|
|
Duration="0:0:0.2"
|
|
Storyboard.TargetName="slot"
|
|
Storyboard.TargetProperty="Intensity"
|
|
To="0.5" />
|
|
</Storyboard>
|
|
<!-- 取消聚焦对象 -->
|
|
<Storyboard x:Key="TextBox.LeaveEffect">
|
|
<DoubleAnimation
|
|
Duration="0:0:0.2"
|
|
Storyboard.TargetName="slot"
|
|
Storyboard.TargetProperty="Intensity"
|
|
To="0.2" />
|
|
</Storyboard>
|
|
</ControlTemplate.Resources>
|
|
<decorations:SlotBorder
|
|
Background="{TemplateBinding Background}"
|
|
BorderBrush="{TemplateBinding BorderBrush}"
|
|
BorderThickness="{TemplateBinding BorderThickness}"
|
|
Intensity="0.2"
|
|
Padding="{TemplateBinding Padding}"
|
|
SnapsToDevicePixels="True"
|
|
x:Name="slot">
|
|
<!-- Margin="{Binding Padding, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}, Converter={x:Static converters:ThicknessReverseConverter.Instance}}" -->
|
|
<ScrollViewer
|
|
Background="{x:Null}"
|
|
BorderThickness="0"
|
|
Focusable="False"
|
|
HorizontalScrollBarVisibility="Hidden"
|
|
IsTabStop="False"
|
|
VerticalScrollBarVisibility="Hidden"
|
|
x:Name="PART_ContentHost" />
|
|
</decorations:SlotBorder>
|
|
|
|
<ControlTemplate.Triggers>
|
|
<Trigger Property="IsEnabled" Value="False">
|
|
<Setter Property="Foreground" Value="{DynamicResource TextDisabledBrush}" />
|
|
<Setter Property="ShaderEnabled" TargetName="slot" Value="False" />
|
|
</Trigger>
|
|
<Trigger Property="IsReadOnly" Value="True">
|
|
<Setter Property="Foreground" Value="{DynamicResource TextSecondaryBrush}" />
|
|
</Trigger>
|
|
|
|
<!--<Trigger Property="IsMouseOver" Value="True" />-->
|
|
|
|
<!--<Trigger Property="IsKeyboardFocused" Value="True" />-->
|
|
<MultiTrigger>
|
|
<MultiTrigger.Conditions>
|
|
<Condition Property="IsMouseOver" Value="False" />
|
|
<Condition Property="IsKeyboardFocused" Value="False" />
|
|
</MultiTrigger.Conditions>
|
|
<MultiTrigger.EnterActions>
|
|
<BeginStoryboard Storyboard="{StaticResource TextBox.LeaveEffect}" />
|
|
</MultiTrigger.EnterActions>
|
|
<MultiTrigger.ExitActions>
|
|
<BeginStoryboard Storyboard="{StaticResource TextBox.FocusEffect}" />
|
|
</MultiTrigger.ExitActions>
|
|
</MultiTrigger>
|
|
</ControlTemplate.Triggers>
|
|
</ControlTemplate>
|
|
</Setter.Value>
|
|
</Setter>
|
|
<Style.Triggers>
|
|
<MultiTrigger>
|
|
<MultiTrigger.Conditions>
|
|
<Condition Property="IsInactiveSelectionHighlightEnabled" Value="True" />
|
|
<Condition Property="IsSelectionActive" Value="False" />
|
|
</MultiTrigger.Conditions>
|
|
<Setter Property="SelectionBrush" Value="{DynamicResource {x:Static SystemColors.InactiveSelectionHighlightBrushKey}}" />
|
|
</MultiTrigger>
|
|
</Style.Triggers>
|
|
</Style>
|
|
|
|
<Style TargetType="{x:Type RichTextBox}">
|
|
<Style.Resources>
|
|
<Style TargetType="{x:Type FlowDocument}" x:Key="{x:Type FlowDocument}">
|
|
<Setter Property="OverridesDefaultStyle" Value="True" />
|
|
</Style>
|
|
<Style
|
|
BasedOn="{StaticResource {x:Type Hyperlink}}"
|
|
TargetType="{x:Type Hyperlink}"
|
|
x:Key="{x:Type Hyperlink}">
|
|
<Style.Triggers>
|
|
<Trigger Property="IsMouseOver" Value="True">
|
|
<Setter Property="Foreground" Value="{DynamicResource PrimaryNormalBrush}" />
|
|
</Trigger>
|
|
<Trigger Property="IsEnabled" Value="False">
|
|
<Setter Property="Foreground" Value="{DynamicResource TextDisabledBrush}" />
|
|
</Trigger>
|
|
</Style.Triggers>
|
|
</Style>
|
|
</Style.Resources>
|
|
<Setter Property="Background" Value="{DynamicResource ControlBackgroundNormalBrush}" />
|
|
<Setter Property="BorderBrush" Value="Transparent" />
|
|
<Setter Property="Foreground" Value="{DynamicResource TextPrimaryBrush}" />
|
|
<Setter Property="BorderThickness" Value="1" />
|
|
<Setter Property="FontSize" Value="14" />
|
|
<Setter Property="KeyboardNavigation.TabNavigation" Value="None" />
|
|
<Setter Property="HorizontalContentAlignment" Value="Left" />
|
|
<Setter Property="VerticalContentAlignment" Value="Center" />
|
|
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
|
|
<Setter Property="AllowDrop" Value="True" />
|
|
<Setter Property="ScrollViewer.PanningMode" Value="VerticalFirst" />
|
|
<Setter Property="Stylus.IsFlicksEnabled" Value="False" />
|
|
<Setter Property="ContextMenu" Value="{DynamicResource TextBoxContextMenu}" />
|
|
<Setter Property="VerticalAlignment" Value="Center" />
|
|
<Setter Property="MinWidth" Value="10" />
|
|
<Setter Property="Padding" Value="2,4" />
|
|
<Setter Property="Template">
|
|
<Setter.Value>
|
|
<ControlTemplate TargetType="{x:Type RichTextBox}">
|
|
<Border
|
|
Background="{TemplateBinding Background}"
|
|
BorderBrush="{TemplateBinding BorderBrush}"
|
|
BorderThickness="{TemplateBinding BorderThickness}"
|
|
CornerRadius="{TemplateBinding assists:ControlAssist.CornerRadius}"
|
|
Padding="{TemplateBinding Padding}"
|
|
SnapsToDevicePixels="True"
|
|
x:Name="ContentBorder">
|
|
<ScrollViewer
|
|
Background="{x:Null}"
|
|
BorderThickness="0"
|
|
Focusable="False"
|
|
HorizontalScrollBarVisibility="Hidden"
|
|
IsTabStop="False"
|
|
VerticalScrollBarVisibility="Hidden"
|
|
x:Name="PART_ContentHost" />
|
|
</Border>
|
|
|
|
<ControlTemplate.Triggers>
|
|
<Trigger Property="IsEnabled" Value="False">
|
|
<Setter Property="Foreground" Value="{DynamicResource TextDisabledBrush}" />
|
|
<Setter Property="Background" Value="{DynamicResource ControlBackgroundDisabledBrush}" />
|
|
<Setter Property="Cursor" Value="None" />
|
|
</Trigger>
|
|
<Trigger Property="IsReadOnly" Value="True">
|
|
<Setter Property="Foreground" Value="{DynamicResource TextSecondaryBrush}" />
|
|
</Trigger>
|
|
<Trigger Property="IsMouseOver" Value="True">
|
|
<Setter Property="Background" TargetName="ContentBorder" Value="{DynamicResource ControlBackgroundHoverBrush}" />
|
|
</Trigger>
|
|
<Trigger Property="IsFocused" Value="True">
|
|
<Setter Property="BorderBrush" TargetName="ContentBorder" Value="{DynamicResource PrimaryNormalBrush}" />
|
|
</Trigger>
|
|
<!--<Trigger Property="IsMouseOver" Value="True" />-->
|
|
|
|
<!--<Trigger Property="IsKeyboardFocused" Value="True" />-->
|
|
|
|
</ControlTemplate.Triggers>
|
|
</ControlTemplate>
|
|
</Setter.Value>
|
|
</Setter>
|
|
<Style.Triggers>
|
|
<MultiTrigger>
|
|
<MultiTrigger.Conditions>
|
|
<Condition Property="IsInactiveSelectionHighlightEnabled" Value="True" />
|
|
<Condition Property="IsSelectionActive" Value="False" />
|
|
</MultiTrigger.Conditions>
|
|
<Setter Property="SelectionBrush" Value="{DynamicResource {x:Static SystemColors.InactiveSelectionHighlightBrushKey}}" />
|
|
</MultiTrigger>
|
|
</Style.Triggers>
|
|
</Style>
|
|
|
|
<!-- 工具栏文本框样式 -->
|
|
<Style TargetType="{x:Type TextBox}" x:Key="{x:Static ToolBar.TextBoxStyleKey}">
|
|
<Setter Property="Background" Value="{DynamicResource ControlBackgroundNormalBrush}" />
|
|
<Setter Property="BorderBrush" Value="{DynamicResource BorderNormalBrush}" />
|
|
<Setter Property="Foreground" Value="{DynamicResource TextPrimaryBrush}" />
|
|
<Setter Property="BorderThickness" Value="1" />
|
|
<Setter Property="FontSize" Value="14" />
|
|
<Setter Property="Padding" Value="4,2" />
|
|
<Setter Property="Margin" Value="2" />
|
|
<Setter Property="KeyboardNavigation.TabNavigation" Value="None" />
|
|
<Setter Property="HorizontalContentAlignment" Value="Left" />
|
|
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
|
|
<Setter Property="AllowDrop" Value="True" />
|
|
<Setter Property="ScrollViewer.PanningMode" Value="VerticalFirst" />
|
|
<Setter Property="Stylus.IsFlicksEnabled" Value="False" />
|
|
<Setter Property="Template">
|
|
<Setter.Value>
|
|
<ControlTemplate TargetType="{x:Type TextBox}">
|
|
<Border
|
|
Background="{TemplateBinding Background}"
|
|
BorderBrush="{TemplateBinding BorderBrush}"
|
|
BorderThickness="{TemplateBinding BorderThickness}"
|
|
CornerRadius="4"
|
|
SnapsToDevicePixels="True"
|
|
x:Name="border">
|
|
<ScrollViewer
|
|
Focusable="False"
|
|
HorizontalScrollBarVisibility="Hidden"
|
|
VerticalScrollBarVisibility="Hidden"
|
|
x:Name="PART_ContentHost" />
|
|
</Border>
|
|
<ControlTemplate.Triggers>
|
|
<Trigger Property="IsEnabled" Value="False">
|
|
<Setter Property="TextElement.Foreground" TargetName="PART_ContentHost" Value="{DynamicResource TextDisabledBrush}" />
|
|
<Setter Property="Background" Value="{DynamicResource ControlBackgroundDisabledBrush}" />
|
|
</Trigger>
|
|
|
|
<Trigger Property="IsMouseOver" Value="True">
|
|
<Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource PrimaryNormalBrush}" />
|
|
</Trigger>
|
|
|
|
<Trigger Property="IsKeyboardFocused" Value="True">
|
|
<Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource PrimaryFocusedBrush}" />
|
|
|
|
</Trigger>
|
|
</ControlTemplate.Triggers>
|
|
</ControlTemplate>
|
|
</Setter.Value>
|
|
</Setter>
|
|
</Style>
|
|
|
|
|
|
</ResourceDictionary> |