更新
This commit is contained in:
@@ -1,36 +1,32 @@
|
||||
<ResourceDictionary
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:controls="clr-namespace:WPFluent.Controls">
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:controls="clr-namespace:WPFluent.Controls">
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="pack://application:,,,/WPFluent;component/Controls/TextBox/TextBox.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
|
||||
<ControlTemplate x:Key="DefaultUiTextBoxcontrolsontrolTemplate" TargetType="{x:Type controls:TextBoxEx}">
|
||||
<DockPanel>
|
||||
<TextBlock
|
||||
x:Name="Header_TextBlock"
|
||||
Margin="5"
|
||||
VerticalAlignment="Center"
|
||||
DockPanel.Dock="{TemplateBinding HeaderPlacement}"
|
||||
Focusable="False"
|
||||
Foreground="{TemplateBinding Foreground}"
|
||||
Text="{TemplateBinding Header}" />
|
||||
<Grid
|
||||
x:Name="Grid"
|
||||
HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
|
||||
VerticalAlignment="{TemplateBinding VerticalAlignment}">
|
||||
<Border
|
||||
Name="ContentBorder"
|
||||
MinWidth="{TemplateBinding MinWidth}"
|
||||
MinHeight="{TemplateBinding MinHeight}"
|
||||
Padding="0"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Stretch"
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
CornerRadius="{TemplateBinding Border.CornerRadius}">
|
||||
<TextBlock x:Name="Header_TextBlock"
|
||||
Margin="5"
|
||||
VerticalAlignment="Center"
|
||||
DockPanel.Dock="{TemplateBinding HeaderPlacement}"
|
||||
Focusable="False"
|
||||
Foreground="{TemplateBinding Foreground}"
|
||||
Text="{TemplateBinding Header}" />
|
||||
<Grid x:Name="Grid"
|
||||
HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
|
||||
VerticalAlignment="{TemplateBinding VerticalAlignment}">
|
||||
<Border MinWidth="{TemplateBinding MinWidth}"
|
||||
MinHeight="{TemplateBinding MinHeight}"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Stretch"
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
CornerRadius="{TemplateBinding Border.CornerRadius}"
|
||||
Name="ContentBorder"
|
||||
Padding="0">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
@@ -40,97 +36,89 @@
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<ContentPresenter
|
||||
Name="ControlIconLeft"
|
||||
Grid.Column="0"
|
||||
Margin="{StaticResource TextBoxLeftIconMargin}"
|
||||
VerticalAlignment="Center"
|
||||
Content="{TemplateBinding Icon}"
|
||||
Focusable="False"
|
||||
TextElement.FontSize="{TemplateBinding FontSize}"
|
||||
Visibility="Visible" />
|
||||
<TextBlock
|
||||
x:Name="PART_Prefix"
|
||||
Grid.Column="1"
|
||||
Padding="4,0"
|
||||
VerticalAlignment="Center"
|
||||
Foreground="{DynamicResource TextControlPlaceholderForeground}"
|
||||
IsHitTestVisible="False"
|
||||
Text="{TemplateBinding Prefix}" />
|
||||
<!-- 内容 -->
|
||||
<Grid
|
||||
Grid.Column="2"
|
||||
Margin="{TemplateBinding Padding}"
|
||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
|
||||
<ContentPresenter Grid.Column="0"
|
||||
Margin="{StaticResource TextBoxLeftIconMargin}"
|
||||
VerticalAlignment="Center"
|
||||
Content="{TemplateBinding Icon}"
|
||||
Focusable="False"
|
||||
Name="ControlIconLeft"
|
||||
TextElement.FontSize="{TemplateBinding FontSize}"
|
||||
Visibility="Visible" />
|
||||
<TextBlock x:Name="PART_Prefix"
|
||||
Grid.Column="1"
|
||||
VerticalAlignment="Center"
|
||||
Foreground="{DynamicResource TextFillColorSecondaryBrush}"
|
||||
IsHitTestVisible="False"
|
||||
Padding="4,0"
|
||||
Text="{TemplateBinding Prefix}" />
|
||||
<!-- 内容 -->
|
||||
<Grid Grid.Column="2"
|
||||
Margin="{TemplateBinding Padding}"
|
||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<controls:PassiveScrollViewer
|
||||
x:Name="PART_ContentHost"
|
||||
Foreground="{TemplateBinding Foreground}"
|
||||
IsDeferredScrollingEnabled="{TemplateBinding ScrollViewer.IsDeferredScrollingEnabled}"
|
||||
IsTabStop="{TemplateBinding ScrollViewer.IsTabStop}"
|
||||
ScrollViewer.CanContentScroll="{TemplateBinding ScrollViewer.CanContentScroll}"
|
||||
ScrollViewer.HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}"
|
||||
ScrollViewer.VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}"
|
||||
Style="{DynamicResource DefaultTextBoxScrollViewerStyle}" />
|
||||
<TextBlock
|
||||
Name="PlaceholderTextBlock"
|
||||
Margin="0"
|
||||
Padding="1,0"
|
||||
VerticalAlignment="Center"
|
||||
Foreground="{DynamicResource TextControlPlaceholderForeground}"
|
||||
Text="{TemplateBinding PlaceholderText}"
|
||||
TextBlock.FontSize="{TemplateBinding FontSize}" />
|
||||
<controls:PassiveScrollViewer x:Name="PART_ContentHost"
|
||||
CanContentScroll="{TemplateBinding ScrollViewer.CanContentScroll}"
|
||||
Foreground="{TemplateBinding Foreground}"
|
||||
HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}"
|
||||
IsDeferredScrollingEnabled="{TemplateBinding ScrollViewer.IsDeferredScrollingEnabled}"
|
||||
IsTabStop="{TemplateBinding ScrollViewer.IsTabStop}"
|
||||
Style="{DynamicResource DefaultTextBoxScrollViewerStyle}"
|
||||
VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}" />
|
||||
<TextBlock Grid.Column="0"
|
||||
Margin="0"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="{TemplateBinding FontSize}"
|
||||
Foreground="{DynamicResource TextFillColorSecondaryBrush}"
|
||||
Name="PlaceholderTextBlock"
|
||||
Padding="1,0"
|
||||
Text="{TemplateBinding PlaceholderText}" />
|
||||
</Grid>
|
||||
<controls:Button
|
||||
x:Name="ClearButton"
|
||||
Grid.Column="3"
|
||||
MinWidth="{StaticResource TextBoxClearButtonHeight}"
|
||||
MinHeight="{StaticResource TextBoxClearButtonHeight}"
|
||||
Margin="{StaticResource TextBoxClearButtonMargin}"
|
||||
Padding="{StaticResource TextBoxClearButtonPadding}"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalContentAlignment="Center"
|
||||
VerticalContentAlignment="Center"
|
||||
Appearance="Secondary"
|
||||
Background="Transparent"
|
||||
BorderBrush="Transparent"
|
||||
Command="{Binding Path=TemplateButtonCommand, RelativeSource={RelativeSource TemplatedParent}}"
|
||||
Cursor="Arrow"
|
||||
Foreground="{DynamicResource TextControlButtonForeground}"
|
||||
IsTabStop="False">
|
||||
<controls:Button x:Name="ClearButton"
|
||||
Grid.Column="3"
|
||||
MinWidth="{StaticResource TextBoxClearButtonHeight}"
|
||||
MinHeight="{StaticResource TextBoxClearButtonHeight}"
|
||||
Margin="{StaticResource TextBoxClearButtonMargin}"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalContentAlignment="Center"
|
||||
VerticalContentAlignment="Center"
|
||||
Appearance="Primary"
|
||||
Background="Transparent"
|
||||
BorderBrush="Transparent"
|
||||
Command="{Binding Path=TemplateButtonCommand, RelativeSource={RelativeSource TemplatedParent}}"
|
||||
Cursor="Arrow"
|
||||
Foreground="{DynamicResource TextFillColorSecondaryBrush}"
|
||||
IsTabStop="False"
|
||||
Padding="{StaticResource TextBoxClearButtonPadding}">
|
||||
<controls:Button.Icon>
|
||||
<controls:SymbolIcon FontSize="{TemplateBinding FontSize}" Symbol="Dismiss24" />
|
||||
</controls:Button.Icon>
|
||||
</controls:Button>
|
||||
<TextBlock
|
||||
x:Name="PART_Suffix"
|
||||
Grid.Column="4"
|
||||
Padding="4,0"
|
||||
VerticalAlignment="Center"
|
||||
Foreground="{DynamicResource TextControlPlaceholderForeground}"
|
||||
IsHitTestVisible="False"
|
||||
Text="{TemplateBinding Suffix}" />
|
||||
<ContentPresenter
|
||||
Name="ControlIconRight"
|
||||
Grid.Column="5"
|
||||
Margin="{StaticResource TextBoxRightIconMargin}"
|
||||
VerticalAlignment="Center"
|
||||
Content="{TemplateBinding Icon}"
|
||||
TextElement.FontSize="{TemplateBinding FontSize}" />
|
||||
<TextBlock x:Name="PART_Suffix"
|
||||
Grid.Column="4"
|
||||
VerticalAlignment="Center"
|
||||
Foreground="{DynamicResource TextFillColorSecondaryBrush}"
|
||||
IsHitTestVisible="False"
|
||||
Padding="4,0"
|
||||
Text="{TemplateBinding Suffix}" />
|
||||
<ContentPresenter Grid.Column="5"
|
||||
Margin="{StaticResource TextBoxRightIconMargin}"
|
||||
VerticalAlignment="Center"
|
||||
Content="{TemplateBinding Icon}"
|
||||
Name="ControlIconRight"
|
||||
TextElement.FontSize="{TemplateBinding FontSize}" />
|
||||
</Grid>
|
||||
</Border>
|
||||
<Border
|
||||
Name="AccentBorder"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Stretch"
|
||||
BorderBrush="{DynamicResource ControlStrokeColorDefaultBrush}"
|
||||
BorderThickness="{StaticResource TextBoxAccentBorderThemeThickness}"
|
||||
CornerRadius="{TemplateBinding Border.CornerRadius}" />
|
||||
<Border HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Stretch"
|
||||
BorderBrush="{DynamicResource ControlStrokeColorDefaultBrush}"
|
||||
BorderThickness="{StaticResource TextBoxAccentBorderThemeThickness}"
|
||||
CornerRadius="{TemplateBinding Border.CornerRadius}"
|
||||
Name="AccentBorder" />
|
||||
</Grid>
|
||||
</DockPanel>
|
||||
<ControlTemplate.Triggers>
|
||||
@@ -138,45 +126,45 @@
|
||||
<Setter TargetName="Header_TextBlock" Property="Margin" Value="0" />
|
||||
<Setter TargetName="Header_TextBlock" Property="Visibility" Value="Collapsed" />
|
||||
</Trigger>
|
||||
<!-- 标题左右对齐时,控制最小宽度 -->
|
||||
<!-- 标题左右对齐时,控制最小宽度 -->
|
||||
<Trigger Property="HeaderPlacement" Value="Left">
|
||||
<Setter TargetName="Grid" Property="MinWidth" Value="80" />
|
||||
<Setter TargetName="Header_TextBlock" Property="HorizontalAlignment" Value="Right" />
|
||||
<Setter TargetName="Grid" Property="MinWidth" Value="80" />
|
||||
</Trigger>
|
||||
<Trigger Property="HeaderPlacement" Value="Right">
|
||||
<Setter TargetName="Grid" Property="MinWidth" Value="80" />
|
||||
<Setter TargetName="Header_TextBlock" Property="HorizontalAlignment" Value="Left" />
|
||||
<Setter TargetName="Grid" Property="MinWidth" Value="80" />
|
||||
</Trigger>
|
||||
<Trigger Property="controls:TextBoxEx.PlaceholderEnabled" Value="False">
|
||||
<Setter TargetName="PlaceholderTextBlock" Property="Visibility" Value="Collapsed" />
|
||||
</Trigger>
|
||||
<Trigger Property="controls:TextBoxEx.ShowClearButton" Value="False">
|
||||
<Setter TargetName="ClearButton" Property="Visibility" Value="Collapsed" />
|
||||
<Setter TargetName="ClearButton" Property="Margin" Value="0" />
|
||||
<Setter TargetName="ClearButton" Property="Visibility" Value="Collapsed" />
|
||||
</Trigger>
|
||||
<Trigger Property="controls:TextBoxEx.ClearButtonEnabled" Value="False">
|
||||
<Setter TargetName="ClearButton" Property="Visibility" Value="Collapsed" />
|
||||
<Setter TargetName="ClearButton" Property="Margin" Value="0" />
|
||||
<Setter TargetName="ClearButton" Property="Visibility" Value="Collapsed" />
|
||||
</Trigger>
|
||||
<Trigger Property="controls:TextBoxEx.IconPlacement" Value="Left">
|
||||
<Setter TargetName="ControlIconRight" Property="Visibility" Value="Collapsed" />
|
||||
<Setter TargetName="ControlIconRight" Property="Margin" Value="0" />
|
||||
<Setter TargetName="ControlIconRight" Property="Visibility" Value="Collapsed" />
|
||||
</Trigger>
|
||||
<Trigger Property="controls:TextBoxEx.IconPlacement" Value="Right">
|
||||
<Setter TargetName="ControlIconLeft" Property="Visibility" Value="Collapsed" />
|
||||
<Setter TargetName="ControlIconLeft" Property="Margin" Value="0" />
|
||||
<Setter TargetName="ControlIconLeft" Property="Visibility" Value="Collapsed" />
|
||||
</Trigger>
|
||||
<Trigger Property="controls:TextBoxEx.Icon" Value="{x:Null}">
|
||||
<Setter TargetName="ControlIconRight" Property="Visibility" Value="Collapsed" />
|
||||
<Setter TargetName="ControlIconRight" Property="Margin" Value="0" />
|
||||
<Setter TargetName="ControlIconLeft" Property="Visibility" Value="Collapsed" />
|
||||
<Setter TargetName="ControlIconLeft" Property="Margin" Value="0" />
|
||||
<Setter TargetName="ControlIconRight" Property="Visibility" Value="Collapsed" />
|
||||
<Setter TargetName="ControlIconLeft" Property="Visibility" Value="Collapsed" />
|
||||
</Trigger>
|
||||
<Trigger Property="UIElement.IsFocused" Value="True">
|
||||
<Setter TargetName="AccentBorder" Property="BorderThickness" Value="0,0,0,2" />
|
||||
<!--<Setter TargetName="PlaceholderTextBlock" Property="Visibility" Value="Collapsed"/>-->
|
||||
<Setter TargetName="AccentBorder" Property="BorderBrush" Value="{DynamicResource TextControlFocusedBorderBrush}" />
|
||||
<Setter TargetName="ContentBorder" Property="Background" Value="{DynamicResource TextControlBackgroundFocused}" />
|
||||
<!-- <Setter TargetName="PlaceholderTextBlock" Property="Visibility" Value="Collapsed"/> -->
|
||||
<Setter TargetName="ContentBorder" Property="Background" Value="{DynamicResource ControlFillColorInputActiveBrush}" />
|
||||
<Setter TargetName="AccentBorder" Property="BorderBrush" Value="{DynamicResource SystemFillColorAttentionBrush}" />
|
||||
</Trigger>
|
||||
<MultiTrigger>
|
||||
<MultiTrigger.Conditions>
|
||||
@@ -184,24 +172,24 @@
|
||||
<Condition Property="UIElement.IsMouseOver" Value="True" />
|
||||
<Condition Property="UIElement.IsFocused" Value="False" />
|
||||
</MultiTrigger.Conditions>
|
||||
<Setter TargetName="ContentBorder" Property="Background" Value="{DynamicResource TextControlBackgroundPointerOver}" />
|
||||
<Setter TargetName="ContentBorder" Property="Background" Value="{DynamicResource ControlFillColorSecondaryBrush}" />
|
||||
</MultiTrigger>
|
||||
<Trigger Property="TextBoxBase.IsReadOnly" Value="True">
|
||||
<Setter TargetName="ClearButton" Property="Visibility" Value="Collapsed" />
|
||||
<Setter TargetName="ClearButton" Property="Margin" Value="0" />
|
||||
<Setter TargetName="ClearButton" Property="Visibility" Value="Collapsed" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsEnabled" Value="True">
|
||||
<Setter Property="FrameworkElement.Cursor" Value="IBeam" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsEnabled" Value="False">
|
||||
<Setter TargetName="ContentBorder" Property="Background" Value="{DynamicResource TextControlBackgroundDisabled}" />
|
||||
<Setter TargetName="ContentBorder" Property="BorderBrush" Value="{DynamicResource TextControlBorderBrushDisabled}" />
|
||||
<Setter TargetName="AccentBorder" Property="BorderBrush" Value="{DynamicResource TextControlBorderBrushDisabled}" />
|
||||
<Setter TargetName="ControlIconLeft" Property="TextElement.Foreground" Value="{DynamicResource TextControlForegroundDisabled}" />
|
||||
<Setter TargetName="ControlIconRight" Property="TextElement.Foreground" Value="{DynamicResource TextControlForegroundDisabled}" />
|
||||
<Setter TargetName="PlaceholderTextBlock" Property="Foreground" Value="{DynamicResource TextControlForegroundDisabled}" />
|
||||
<Setter Property="Foreground" Value="{DynamicResource TextControlForegroundDisabled}" />
|
||||
<Setter TargetName="ContentBorder" Property="Background" Value="{DynamicResource ControlFillColorDisabledBrush}" />
|
||||
<Setter TargetName="ContentBorder" Property="BorderBrush" Value="{DynamicResource ControlStrokeColorDefaultBrush}" />
|
||||
<Setter TargetName="AccentBorder" Property="BorderBrush" Value="{DynamicResource ControlStrokeColorDefaultBrush}" />
|
||||
<Setter Property="controls:TextBoxEx.ClearButtonEnabled" Value="False" />
|
||||
<Setter TargetName="PlaceholderTextBlock" Property="Foreground" Value="{DynamicResource TextFillColorDisabledBrush}" />
|
||||
<Setter Property="Foreground" Value="{DynamicResource TextFillColorDisabledBrush}" />
|
||||
<Setter TargetName="ControlIconLeft" Property="TextElement.Foreground" Value="{DynamicResource TextFillColorDisabledBrush}" />
|
||||
<Setter TargetName="ControlIconRight" Property="TextElement.Foreground" Value="{DynamicResource TextFillColorDisabledBrush}" />
|
||||
</Trigger>
|
||||
<Trigger Property="Prefix" Value="{x:Null}">
|
||||
<Setter TargetName="PART_Prefix" Property="Margin" Value="0" />
|
||||
@@ -215,69 +203,78 @@
|
||||
</ControlTemplate>
|
||||
<ControlTemplate x:Key="DefaultUiTextBoxTextExSelectionEnabledControlTemplate" TargetType="{x:Type controls:TextBoxEx}">
|
||||
<Grid HorizontalAlignment="{TemplateBinding HorizontalAlignment}" VerticalAlignment="{TemplateBinding VerticalAlignment}">
|
||||
<Border
|
||||
Name="ContentBorder"
|
||||
MinWidth="{TemplateBinding MinWidth}"
|
||||
MinHeight="{TemplateBinding MinHeight}"
|
||||
Padding="0"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Stretch"
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
CornerRadius="{TemplateBinding Border.CornerRadius}"
|
||||
Focusable="False">
|
||||
<Border MinWidth="{TemplateBinding MinWidth}"
|
||||
MinHeight="{TemplateBinding MinHeight}"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Stretch"
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
CornerRadius="{TemplateBinding Border.CornerRadius}"
|
||||
Focusable="False"
|
||||
Name="ContentBorder"
|
||||
Padding="0">
|
||||
<Grid HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
|
||||
<Grid Margin="{TemplateBinding Padding}">
|
||||
<controls:PassiveScrollViewer
|
||||
x:Name="PART_ContentHost"
|
||||
Foreground="{TemplateBinding Foreground}"
|
||||
IsDeferredScrollingEnabled="{TemplateBinding ScrollViewer.IsDeferredScrollingEnabled}"
|
||||
IsTabStop="{TemplateBinding ScrollViewer.IsTabStop}"
|
||||
ScrollViewer.CanContentScroll="{TemplateBinding ScrollViewer.CanContentScroll}"
|
||||
ScrollViewer.HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}"
|
||||
ScrollViewer.VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}"
|
||||
Style="{DynamicResource DefaultTextBoxScrollViewerStyle}" />
|
||||
<controls:PassiveScrollViewer x:Name="PART_ContentHost"
|
||||
CanContentScroll="{TemplateBinding ScrollViewer.CanContentScroll}"
|
||||
Foreground="{TemplateBinding Foreground}"
|
||||
HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}"
|
||||
IsDeferredScrollingEnabled="{TemplateBinding ScrollViewer.IsDeferredScrollingEnabled}"
|
||||
IsTabStop="{TemplateBinding ScrollViewer.IsTabStop}"
|
||||
Style="{DynamicResource DefaultTextBoxScrollViewerStyle}"
|
||||
VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}" />
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Border>
|
||||
</Grid>
|
||||
</ControlTemplate>
|
||||
<!-- 右侧错误模板 -->
|
||||
<ControlTemplate x:Key="ValidationErrorTemplate">
|
||||
<DockPanel LastChildFill="True">
|
||||
<TextBlock Margin="5,0,0,0"
|
||||
VerticalAlignment="Center"
|
||||
DockPanel.Dock="Bottom"
|
||||
Foreground="Red"
|
||||
Text="{Binding [0].ErrorContent}" />
|
||||
<AdornedElementPlaceholder />
|
||||
</DockPanel>
|
||||
</ControlTemplate>
|
||||
<!-- 提示错误模板 -->
|
||||
<ControlTemplate x:Key="TextBoxExErrorTemplate">
|
||||
<StackPanel>
|
||||
<AdornedElementPlaceholder Name="Adorner" />
|
||||
<TextBlock
|
||||
HorizontalAlignment="Right"
|
||||
Foreground="Red"
|
||||
Text="{Binding ElementName=Adorner, Path=AdornedElement.(Validation.Errors)[0].ErrorContent}" />
|
||||
<TextBlock HorizontalAlignment="Right"
|
||||
Foreground="Red"
|
||||
Text="{Binding ElementName=Adorner, Path=AdornedElement.(Validation.Errors).CurrentItem.ErrorContent}" />
|
||||
</StackPanel>
|
||||
</ControlTemplate>
|
||||
<Style x:Key="DefaultUiTextBoxExStyle" TargetType="{x:Type controls:TextBoxEx}">
|
||||
<Setter Property="FrameworkElement.FocusVisualStyle" Value="{DynamicResource DefaultControlFocusVisualStyle}" />
|
||||
<Setter Property="FrameworkElement.ContextMenu" Value="{DynamicResource DefaultControlContextMenu}" />
|
||||
<Setter Property="Foreground" Value="{DynamicResource TextControlForeground}" />
|
||||
<Setter Property="TextBoxBase.CaretBrush" Value="{DynamicResource TextControlForeground}" />
|
||||
<Setter Property="Background" Value="{DynamicResource TextControlBackground}" />
|
||||
<Setter Property="Background" Value="{DynamicResource ControlFillColorDefaultBrush}" />
|
||||
<Setter Property="Border.CornerRadius" Value="{StaticResource ControlCornerRadius}" />
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource TextControlElevationBorderBrush}" />
|
||||
<Setter Property="BorderThickness" Value="{StaticResource TextBoxBorderThemeThickness}" />
|
||||
<Setter Property="CaretBrush" Value="{DynamicResource TextFillColorPrimaryBrush}" />
|
||||
<Setter Property="ClearButtonEnabled" Value="True" />
|
||||
<Setter Property="ContextMenu" Value="{DynamicResource DefaultControlContextMenu}" />
|
||||
<Setter Property="FocusVisualStyle" Value="{DynamicResource DefaultControlFocusVisualStyle}" />
|
||||
<Setter Property="FontSize" Value="{StaticResource ControlContentThemeFontSize}" />
|
||||
<Setter Property="ScrollViewer.CanContentScroll" Value="False" />
|
||||
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Hidden" />
|
||||
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Hidden" />
|
||||
<Setter Property="ScrollViewer.IsDeferredScrollingEnabled" Value="False" />
|
||||
<Setter Property="Foreground" Value="{DynamicResource TextFillColorPrimaryBrush}" />
|
||||
<Setter Property="HorizontalAlignment" Value="Stretch" />
|
||||
<Setter Property="VerticalAlignment" Value="Center" />
|
||||
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
|
||||
<Setter Property="VerticalContentAlignment" Value="Stretch" />
|
||||
<Setter Property="IconPlacement" Value="Left" />
|
||||
<Setter Property="MinHeight" Value="{StaticResource TextControlThemeMinHeight}" />
|
||||
<Setter Property="MinWidth" Value="{StaticResource TextControlThemeMinWidth}" />
|
||||
<Setter Property="OverridesDefaultStyle" Value="True" />
|
||||
<Setter Property="Padding" Value="{StaticResource TextControlThemePadding}" />
|
||||
<Setter Property="Border.CornerRadius" Value="{StaticResource ControlCornerRadius}" />
|
||||
<Setter Property="controls:TextBoxEx.ClearButtonEnabled" Value="True" />
|
||||
<Setter Property="controls:TextBoxEx.IconPlacement" Value="Left" />
|
||||
<Setter Property="UIElement.SnapsToDevicePixels" Value="True" />
|
||||
<Setter Property="FrameworkElement.OverridesDefaultStyle" Value="True" />
|
||||
<Setter Property="ScrollViewer.CanContentScroll" Value="False" />
|
||||
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Hidden" />
|
||||
<Setter Property="ScrollViewer.IsDeferredScrollingEnabled" Value="False" />
|
||||
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Hidden" />
|
||||
<Setter Property="SnapsToDevicePixels" Value="True" />
|
||||
<Setter Property="Validation.ErrorTemplate" Value="{StaticResource TextBoxExErrorTemplate}" />
|
||||
<Setter Property="VerticalAlignment" Value="Center" />
|
||||
<Setter Property="VerticalContentAlignment" Value="Stretch" />
|
||||
<Style.Triggers>
|
||||
<Trigger Property="HeaderPlacement" Value="Left">
|
||||
<Setter Property="HorizontalAlignment" Value="Right" />
|
||||
@@ -289,12 +286,12 @@
|
||||
<Setter Property="Template" Value="{StaticResource DefaultUiTextBoxcontrolsontrolTemplate}" />
|
||||
</Trigger>
|
||||
<Trigger Property="controls:TextBoxEx.IsTextSelectionEnabled" Value="True">
|
||||
<Setter Property="TextBoxBase.IsReadOnly" Value="True" />
|
||||
<Setter Property="Background" Value="Transparent" />
|
||||
<Setter Property="Padding" Value="0" />
|
||||
<Setter Property="BorderBrush" Value="Transparent" />
|
||||
<Setter Property="BorderThickness" Value="0" />
|
||||
<Setter Property="Padding" Value="0" />
|
||||
<Setter Property="Template" Value="{StaticResource DefaultUiTextBoxTextExSelectionEnabledControlTemplate}" />
|
||||
<Setter Property="TextBoxBase.IsReadOnly" Value="True" />
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
Reference in New Issue
Block a user