feat: update NonErrorTextBox.
This commit is contained in:
parent
40d7fbcf7f
commit
d27acf269e
@ -24,35 +24,6 @@
|
|||||||
</MenuFlyout>
|
</MenuFlyout>
|
||||||
|
|
||||||
<ControlTheme x:Key="{x:Type TextBox}" TargetType="TextBox">
|
<ControlTheme x:Key="{x:Type TextBox}" TargetType="TextBox">
|
||||||
<ControlTheme.Resources>
|
|
||||||
<ControlTheme x:Key="InputToggleButton" TargetType="ToggleButton">
|
|
||||||
<Setter Property="ToggleButton.Foreground" Value="{DynamicResource ButtonInputInnerForeground}" />
|
|
||||||
<Setter Property="ToggleButton.Cursor" Value="Hand" />
|
|
||||||
<Setter Property="ToggleButton.Template">
|
|
||||||
<ControlTemplate TargetType="ToggleButton">
|
|
||||||
<!-- Background must be transparent or hit test will fail -->
|
|
||||||
<Panel Background="Transparent">
|
|
||||||
<PathIcon
|
|
||||||
Width="16"
|
|
||||||
Height="16"
|
|
||||||
Data="{DynamicResource PasswordBoxRevealButtonData}"
|
|
||||||
IsVisible="{Binding $parent[ToggleButton].IsChecked, Converter={x:Static BoolConverters.Not}}" />
|
|
||||||
<PathIcon
|
|
||||||
Width="16"
|
|
||||||
Height="16"
|
|
||||||
Data="{DynamicResource PasswordBoxHideButtonData}"
|
|
||||||
IsVisible="{Binding $parent[ToggleButton].IsChecked}" />
|
|
||||||
</Panel>
|
|
||||||
</ControlTemplate>
|
|
||||||
</Setter>
|
|
||||||
<Style Selector="^:pointerover">
|
|
||||||
<Setter Property="Foreground" Value="{DynamicResource ButtonInputInnerPointeroverForeground}" />
|
|
||||||
</Style>
|
|
||||||
<Style Selector="^:pressed">
|
|
||||||
<Setter Property="Foreground" Value="{DynamicResource ButtonInputInnerPressedForeground}" />
|
|
||||||
</Style>
|
|
||||||
</ControlTheme>
|
|
||||||
</ControlTheme.Resources>
|
|
||||||
<Setter Property="TextBox.Foreground" Value="{DynamicResource TextBoxForeground}" />
|
<Setter Property="TextBox.Foreground" Value="{DynamicResource TextBoxForeground}" />
|
||||||
<Setter Property="TextBox.Background" Value="{DynamicResource TextBoxDefaultBackground}" />
|
<Setter Property="TextBox.Background" Value="{DynamicResource TextBoxDefaultBackground}" />
|
||||||
<Setter Property="TextBox.BorderBrush" Value="{DynamicResource TextBoxDefaultBorderBrush}" />
|
<Setter Property="TextBox.BorderBrush" Value="{DynamicResource TextBoxDefaultBorderBrush}" />
|
||||||
@ -126,8 +97,7 @@
|
|||||||
SelectionEnd="{TemplateBinding SelectionEnd}"
|
SelectionEnd="{TemplateBinding SelectionEnd}"
|
||||||
SelectionForegroundBrush="{TemplateBinding SelectionForegroundBrush}"
|
SelectionForegroundBrush="{TemplateBinding SelectionForegroundBrush}"
|
||||||
SelectionStart="{TemplateBinding SelectionStart}"
|
SelectionStart="{TemplateBinding SelectionStart}"
|
||||||
Text="{TemplateBinding Text,
|
Text="{TemplateBinding Text, Mode=TwoWay}"
|
||||||
Mode=TwoWay}"
|
|
||||||
TextAlignment="{TemplateBinding TextAlignment}"
|
TextAlignment="{TemplateBinding TextAlignment}"
|
||||||
TextWrapping="{TemplateBinding TextWrapping}" />
|
TextWrapping="{TemplateBinding TextWrapping}" />
|
||||||
</Panel>
|
</Panel>
|
||||||
@ -143,8 +113,7 @@
|
|||||||
Name="PART_RevealButton"
|
Name="PART_RevealButton"
|
||||||
Grid.Column="3"
|
Grid.Column="3"
|
||||||
Margin="4,0,0,0"
|
Margin="4,0,0,0"
|
||||||
IsChecked="{TemplateBinding RevealPassword,
|
IsChecked="{TemplateBinding RevealPassword, Mode=TwoWay}"
|
||||||
Mode=TwoWay}"
|
|
||||||
IsVisible="False"
|
IsVisible="False"
|
||||||
Theme="{StaticResource InputToggleButton}" />
|
Theme="{StaticResource InputToggleButton}" />
|
||||||
<ContentPresenter
|
<ContentPresenter
|
||||||
@ -253,10 +222,10 @@
|
|||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
<Style Selector="^.TextArea">
|
<Style Selector="^.TextArea">
|
||||||
<Setter Property="AcceptsReturn" Value="True"></Setter>
|
<Setter Property="AcceptsReturn" Value="True"/>
|
||||||
<Setter Property="VerticalContentAlignment" Value="Top"></Setter>
|
<Setter Property="VerticalContentAlignment" Value="Top"/>
|
||||||
<Setter Property="TextBox.Padding" Value="{DynamicResource TextBoxTextAreaContentPadding}"></Setter>
|
<Setter Property="Padding" Value="{DynamicResource TextBoxTextAreaContentPadding}" />
|
||||||
<Setter Property="MinHeight" Value="{DynamicResource TextBoxTextAreaHeight}"></Setter>
|
<Setter Property="MinHeight" Value="{DynamicResource TextBoxTextAreaHeight}" />
|
||||||
</Style>
|
</Style>
|
||||||
</ControlTheme>
|
</ControlTheme>
|
||||||
|
|
||||||
@ -266,8 +235,8 @@
|
|||||||
<Setter Property="TextBox.BorderBrush" Value="{DynamicResource TextBoxDefaultBorderBrush}" />
|
<Setter Property="TextBox.BorderBrush" Value="{DynamicResource TextBoxDefaultBorderBrush}" />
|
||||||
<Setter Property="TextBox.SelectionBrush" Value="{DynamicResource TextBoxSelectionBackground}" />
|
<Setter Property="TextBox.SelectionBrush" Value="{DynamicResource TextBoxSelectionBackground}" />
|
||||||
<Setter Property="TextBox.SelectionForegroundBrush" Value="{DynamicResource TextBoxSelectionForeground}" />
|
<Setter Property="TextBox.SelectionForegroundBrush" Value="{DynamicResource TextBoxSelectionForeground}" />
|
||||||
<Setter Property="TextBox.BackgroundSizing" Value="OuterBorderEdge" />
|
|
||||||
<Setter Property="TextBox.BorderThickness" Value="{DynamicResource TextBoxBorderThickness}" />
|
<Setter Property="TextBox.BorderThickness" Value="{DynamicResource TextBoxBorderThickness}" />
|
||||||
|
<Setter Property="TextBox.BackgroundSizing" Value="OuterBorderEdge" />
|
||||||
<Setter Property="TextBox.CornerRadius" Value="{DynamicResource TextBoxDefaultCornerRadius}" />
|
<Setter Property="TextBox.CornerRadius" Value="{DynamicResource TextBoxDefaultCornerRadius}" />
|
||||||
<Setter Property="TextBox.FontSize" Value="14" />
|
<Setter Property="TextBox.FontSize" Value="14" />
|
||||||
<Setter Property="TextBox.Cursor" Value="Ibeam" />
|
<Setter Property="TextBox.Cursor" Value="Ibeam" />
|
||||||
@ -290,7 +259,7 @@
|
|||||||
BorderBrush="{TemplateBinding BorderBrush}"
|
BorderBrush="{TemplateBinding BorderBrush}"
|
||||||
BorderThickness="{TemplateBinding BorderThickness}"
|
BorderThickness="{TemplateBinding BorderThickness}"
|
||||||
CornerRadius="{TemplateBinding CornerRadius}">
|
CornerRadius="{TemplateBinding CornerRadius}">
|
||||||
<Grid Margin="{TemplateBinding Padding}" ColumnDefinitions="Auto, *, Auto">
|
<Grid Margin="{TemplateBinding Padding}" ColumnDefinitions="Auto,*,Auto, Auto, Auto">
|
||||||
<ContentPresenter
|
<ContentPresenter
|
||||||
Grid.Column="0"
|
Grid.Column="0"
|
||||||
Padding="{DynamicResource TextBoxInnerLeftContentPadding}"
|
Padding="{DynamicResource TextBoxInnerLeftContentPadding}"
|
||||||
@ -309,17 +278,22 @@
|
|||||||
Name="PART_Watermark"
|
Name="PART_Watermark"
|
||||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||||
IsVisible="{TemplateBinding Text,
|
|
||||||
Converter={x:Static StringConverters.IsNullOrEmpty}}"
|
|
||||||
Opacity="0.5"
|
Opacity="0.5"
|
||||||
Text="{TemplateBinding Watermark}"
|
Text="{TemplateBinding Watermark}"
|
||||||
TextAlignment="{TemplateBinding TextAlignment}"
|
TextAlignment="{TemplateBinding TextAlignment}"
|
||||||
TextWrapping="{TemplateBinding TextWrapping}" />
|
TextWrapping="{TemplateBinding TextWrapping}">
|
||||||
|
<TextBlock.IsVisible>
|
||||||
|
<MultiBinding Converter="{x:Static BoolConverters.And}">
|
||||||
|
<Binding ElementName="PART_TextPresenter" Path="PreeditText" Converter="{x:Static StringConverters.IsNullOrEmpty}"/>
|
||||||
|
<Binding RelativeSource="{RelativeSource TemplatedParent}" Path="Text" Converter="{x:Static StringConverters.IsNullOrEmpty}"/>
|
||||||
|
</MultiBinding>
|
||||||
|
</TextBlock.IsVisible>
|
||||||
|
</TextBlock>
|
||||||
<TextPresenter
|
<TextPresenter
|
||||||
Name="PART_TextPresenter"
|
Name="PART_TextPresenter"
|
||||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
|
||||||
CaretBlinkInterval="{TemplateBinding CaretBlinkInterval}"
|
CaretBlinkInterval="{TemplateBinding CaretBlinkInterval}"
|
||||||
|
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||||
CaretBrush="{TemplateBinding CaretBrush}"
|
CaretBrush="{TemplateBinding CaretBrush}"
|
||||||
CaretIndex="{TemplateBinding CaretIndex}"
|
CaretIndex="{TemplateBinding CaretIndex}"
|
||||||
LineHeight="{TemplateBinding LineHeight}"
|
LineHeight="{TemplateBinding LineHeight}"
|
||||||
@ -329,14 +303,27 @@
|
|||||||
SelectionEnd="{TemplateBinding SelectionEnd}"
|
SelectionEnd="{TemplateBinding SelectionEnd}"
|
||||||
SelectionForegroundBrush="{TemplateBinding SelectionForegroundBrush}"
|
SelectionForegroundBrush="{TemplateBinding SelectionForegroundBrush}"
|
||||||
SelectionStart="{TemplateBinding SelectionStart}"
|
SelectionStart="{TemplateBinding SelectionStart}"
|
||||||
Text="{TemplateBinding Text,
|
Text="{TemplateBinding Text, Mode=TwoWay}"
|
||||||
Mode=TwoWay}"
|
|
||||||
TextAlignment="{TemplateBinding TextAlignment}"
|
TextAlignment="{TemplateBinding TextAlignment}"
|
||||||
TextWrapping="{TemplateBinding TextWrapping}" />
|
TextWrapping="{TemplateBinding TextWrapping}" />
|
||||||
</Panel>
|
</Panel>
|
||||||
</ScrollViewer>
|
</ScrollViewer>
|
||||||
<ContentPresenter
|
<Button
|
||||||
|
Name="PART_ClearButton"
|
||||||
Grid.Column="2"
|
Grid.Column="2"
|
||||||
|
Command="{Binding $parent[TextBox].Clear}"
|
||||||
|
Content="{DynamicResource IconButtonClearData}"
|
||||||
|
IsVisible="False"
|
||||||
|
Theme="{StaticResource InnerIconButton}" />
|
||||||
|
<ToggleButton
|
||||||
|
Name="PART_RevealButton"
|
||||||
|
Grid.Column="3"
|
||||||
|
Margin="4,0,0,0"
|
||||||
|
IsChecked="{TemplateBinding RevealPassword, Mode=TwoWay}"
|
||||||
|
IsVisible="False"
|
||||||
|
Theme="{StaticResource InputToggleButton}" />
|
||||||
|
<ContentPresenter
|
||||||
|
Grid.Column="4"
|
||||||
Padding="{DynamicResource TextBoxInnerRightContentPadding}"
|
Padding="{DynamicResource TextBoxInnerRightContentPadding}"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
Content="{TemplateBinding InnerRightContent}"
|
Content="{TemplateBinding InnerRightContent}"
|
||||||
@ -383,6 +370,69 @@
|
|||||||
<Setter Property="BorderBrush" Value="{DynamicResource DataValidationErrorsSelectedBorderBrush}" />
|
<Setter Property="BorderBrush" Value="{DynamicResource DataValidationErrorsSelectedBorderBrush}" />
|
||||||
</Style>
|
</Style>
|
||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
|
<Style Selector="^.clearButton, ^.ClearButton">
|
||||||
|
<Style Selector="^[AcceptsReturn=False][IsReadOnly=False]:focus:not(:empty) /template/ Button#PART_ClearButton">
|
||||||
|
<Setter Property="IsVisible" Value="True" />
|
||||||
|
</Style>
|
||||||
|
<Style Selector="^[AcceptsReturn=False][IsReadOnly=False]:pointerover:not(:empty) /template/ Button#PART_ClearButton">
|
||||||
|
<Setter Property="IsVisible" Value="True" />
|
||||||
|
</Style>
|
||||||
|
</Style>
|
||||||
|
<Style Selector="^.revealPasswordButton, ^.RevealPasswordButton">
|
||||||
|
<Style Selector="^ /template/ ToggleButton#PART_RevealButton">
|
||||||
|
<Setter Property="IsVisible" Value="True" />
|
||||||
|
</Style>
|
||||||
|
</Style>
|
||||||
|
<Style Selector="^.Large">
|
||||||
|
<Setter Property="MinHeight" Value="{DynamicResource TextBoxLargeHeight}" />
|
||||||
|
</Style>
|
||||||
|
<Style Selector="^.Small">
|
||||||
|
<Setter Property="MinHeight" Value="{DynamicResource TextBoxSmallHeight}" />
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<Style Selector="^.Bordered">
|
||||||
|
<Setter Property="Background" Value="{DynamicResource TextBoxBorderedDefaultBackground}" />
|
||||||
|
<Setter Property="BorderBrush" Value="{DynamicResource TextBoxBorderedDefaultBorderBrush}" />
|
||||||
|
<Style Selector="^:pointerover /template/ Border#PART_ContentPresenterBorder">
|
||||||
|
<Setter Property="Background" Value="{DynamicResource TextBoxBorderedPointeroverBackground}" />
|
||||||
|
<Setter Property="BorderBrush" Value="{DynamicResource TextBoxBorderedPointeroverBorderBrush}" />
|
||||||
|
</Style>
|
||||||
|
<Style Selector="^:focus">
|
||||||
|
<Setter Property="Background" Value="{DynamicResource TextBoxBorderedPointeroverBackground}" />
|
||||||
|
<Setter Property="BorderBrush" Value="{DynamicResource TextBoxBorderedPointeroverBorderBrush}" />
|
||||||
|
</Style>
|
||||||
|
<Style Selector="^:disabled /template/ Border#PART_ContentPresenterBorder">
|
||||||
|
<Setter Property="TextBox.Background" Value="{DynamicResource TextBoxDisabledBackground}" />
|
||||||
|
<Setter Property="TextBox.BorderBrush" Value="{DynamicResource TextBoxDisabledBorderBrush}" />
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<Style Selector="^:error">
|
||||||
|
<Style Selector="^ /template/ Border#PART_ContentPresenterBorder">
|
||||||
|
<Setter Property="Background" Value="{DynamicResource DataValidationErrorsBackground}" />
|
||||||
|
<Setter Property="BorderBrush" Value="{DynamicResource DataValidationErrorsBorderBrush}" />
|
||||||
|
</Style>
|
||||||
|
<Style Selector="^:pointerover /template/ Border#PART_ContentPresenterBorder">
|
||||||
|
<Setter Property="Background" Value="{DynamicResource DataValidationErrorsPointerOverBackground}" />
|
||||||
|
<Setter Property="BorderBrush" Value="{DynamicResource DataValidationErrorsPointerOverBorderBrush}" />
|
||||||
|
</Style>
|
||||||
|
<Style Selector="^:pressed /template/ Border#PART_ContentPresenterBorder">
|
||||||
|
<Setter Property="Background" Value="{DynamicResource DataValidationErrorsPressedBackground}" />
|
||||||
|
<Setter Property="BorderBrush" Value="{DynamicResource DataValidationErrorsPressedBorderBrush}" />
|
||||||
|
</Style>
|
||||||
|
<Style Selector="^:focus /template/ Border#PART_ContentPresenterBorder">
|
||||||
|
<Setter Property="Background" Value="{DynamicResource DataValidationErrorsSelectedBackground}" />
|
||||||
|
<Setter Property="BorderBrush" Value="{DynamicResource DataValidationErrorsSelectedBorderBrush}" />
|
||||||
|
</Style>
|
||||||
|
</Style>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<Style Selector="^.TextArea">
|
||||||
|
<Setter Property="AcceptsReturn" Value="True"/>
|
||||||
|
<Setter Property="VerticalContentAlignment" Value="Top"/>
|
||||||
|
<Setter Property="Padding" Value="{DynamicResource TextBoxTextAreaContentPadding}" />
|
||||||
|
<Setter Property="MinHeight" Value="{DynamicResource TextBoxTextAreaHeight}" />
|
||||||
|
</Style>
|
||||||
</ControlTheme>
|
</ControlTheme>
|
||||||
|
|
||||||
<ControlTheme x:Key="LooklessTextBox" TargetType="TextBox">
|
<ControlTheme x:Key="LooklessTextBox" TargetType="TextBox">
|
||||||
@ -460,4 +510,32 @@
|
|||||||
</Style>
|
</Style>
|
||||||
</ControlTheme>
|
</ControlTheme>
|
||||||
|
|
||||||
|
<ControlTheme x:Key="InputToggleButton" TargetType="ToggleButton">
|
||||||
|
<Setter Property="ToggleButton.Foreground" Value="{DynamicResource ButtonInputInnerForeground}" />
|
||||||
|
<Setter Property="ToggleButton.Cursor" Value="Hand" />
|
||||||
|
<Setter Property="ToggleButton.Template">
|
||||||
|
<ControlTemplate TargetType="ToggleButton">
|
||||||
|
<!-- Background must be transparent or hit test will fail -->
|
||||||
|
<Panel Background="Transparent">
|
||||||
|
<PathIcon
|
||||||
|
Width="16"
|
||||||
|
Height="16"
|
||||||
|
Data="{DynamicResource PasswordBoxRevealButtonData}"
|
||||||
|
IsVisible="{Binding $parent[ToggleButton].IsChecked, Converter={x:Static BoolConverters.Not}}" />
|
||||||
|
<PathIcon
|
||||||
|
Width="16"
|
||||||
|
Height="16"
|
||||||
|
Data="{DynamicResource PasswordBoxHideButtonData}"
|
||||||
|
IsVisible="{Binding $parent[ToggleButton].IsChecked}" />
|
||||||
|
</Panel>
|
||||||
|
</ControlTemplate>
|
||||||
|
</Setter>
|
||||||
|
<Style Selector="^:pointerover">
|
||||||
|
<Setter Property="Foreground" Value="{DynamicResource ButtonInputInnerPointeroverForeground}" />
|
||||||
|
</Style>
|
||||||
|
<Style Selector="^:pressed">
|
||||||
|
<Setter Property="Foreground" Value="{DynamicResource ButtonInputInnerPressedForeground}" />
|
||||||
|
</Style>
|
||||||
|
</ControlTheme>
|
||||||
|
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user