feat: add validation errors to NumericUpDown.
This commit is contained in:
parent
45f3470d76
commit
d75a4c549e
@ -8,17 +8,12 @@
|
|||||||
d:DesignHeight="450"
|
d:DesignHeight="450"
|
||||||
d:DesignWidth="800"
|
d:DesignWidth="800"
|
||||||
mc:Ignorable="d">
|
mc:Ignorable="d">
|
||||||
<StackPanel HorizontalAlignment="Left">
|
<StackPanel HorizontalAlignment="Left" Spacing="20">
|
||||||
<AutoCompleteBox Width="300">
|
<AutoCompleteBox Width="300">
|
||||||
<DataValidationErrors.Error>
|
<DataValidationErrors.Error>
|
||||||
<system:Exception />
|
<system:Exception />
|
||||||
</DataValidationErrors.Error>
|
</DataValidationErrors.Error>
|
||||||
</AutoCompleteBox>
|
</AutoCompleteBox>
|
||||||
<ButtonSpinner Width="300">
|
|
||||||
<DataValidationErrors.Error>
|
|
||||||
<system:Exception />
|
|
||||||
</DataValidationErrors.Error>
|
|
||||||
</ButtonSpinner>
|
|
||||||
<CalendarDatePicker Width="300">
|
<CalendarDatePicker Width="300">
|
||||||
<DataValidationErrors.Error>
|
<DataValidationErrors.Error>
|
||||||
<system:Exception />
|
<system:Exception />
|
||||||
|
@ -5,45 +5,65 @@
|
|||||||
<!-- Add Resources Here -->
|
<!-- Add Resources Here -->
|
||||||
<ControlTheme x:Key="{x:Type NumericUpDown}" TargetType="NumericUpDown">
|
<ControlTheme x:Key="{x:Type NumericUpDown}" TargetType="NumericUpDown">
|
||||||
<Setter Property="NumericUpDown.VerticalContentAlignment" Value="Center" />
|
<Setter Property="NumericUpDown.VerticalContentAlignment" Value="Center" />
|
||||||
<Setter Property="NumericUpDown.MinHeight" Value="{DynamicResource NumericUpDownWrapperDefaultHeight}" />
|
|
||||||
<Setter Property="NumericUpDown.CornerRadius" Value="{DynamicResource NumericUpDownCornerRadius}" />
|
<Setter Property="NumericUpDown.CornerRadius" Value="{DynamicResource NumericUpDownCornerRadius}" />
|
||||||
<Setter Property="NumericUpDown.Template">
|
<Setter Property="NumericUpDown.Template">
|
||||||
<ControlTemplate TargetType="NumericUpDown">
|
<ControlTemplate TargetType="NumericUpDown">
|
||||||
<ButtonSpinner
|
<DataValidationErrors>
|
||||||
Name="PART_Spinner"
|
<ButtonSpinner
|
||||||
MinWidth="0"
|
Name="PART_Spinner"
|
||||||
HorizontalContentAlignment="Stretch"
|
MinWidth="0"
|
||||||
VerticalContentAlignment="Stretch"
|
HorizontalContentAlignment="Stretch"
|
||||||
AllowSpin="{TemplateBinding AllowSpin}"
|
VerticalContentAlignment="Stretch"
|
||||||
Background="{TemplateBinding Background}"
|
AllowSpin="{TemplateBinding AllowSpin}"
|
||||||
BorderBrush="{TemplateBinding BorderBrush}"
|
Background="{TemplateBinding Background}"
|
||||||
BorderThickness="{TemplateBinding BorderThickness}"
|
BorderBrush="{TemplateBinding BorderBrush}"
|
||||||
ButtonSpinnerLocation="{TemplateBinding ButtonSpinnerLocation}"
|
BorderThickness="{TemplateBinding BorderThickness}"
|
||||||
ShowButtonSpinner="{TemplateBinding ShowButtonSpinner}">
|
ButtonSpinnerLocation="{TemplateBinding ButtonSpinnerLocation}"
|
||||||
<TextBox
|
ShowButtonSpinner="{TemplateBinding ShowButtonSpinner}">
|
||||||
Name="PART_TextBox"
|
<TextBox
|
||||||
Height="{TemplateBinding Height}"
|
Name="PART_TextBox"
|
||||||
MinHeight="{TemplateBinding MinHeight}"
|
Height="{TemplateBinding Height}"
|
||||||
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
|
MinHeight="{DynamicResource NumericUpDownWrapperDefaultHeight}"
|
||||||
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
|
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||||
AcceptsReturn="False"
|
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||||
CornerRadius="{TemplateBinding CornerRadius}"
|
AcceptsReturn="False"
|
||||||
FontSize="{TemplateBinding FontSize}"
|
CornerRadius="{TemplateBinding CornerRadius}"
|
||||||
Foreground="{TemplateBinding Foreground}"
|
FontSize="{TemplateBinding FontSize}"
|
||||||
IsReadOnly="{TemplateBinding IsReadOnly}"
|
Foreground="{TemplateBinding Foreground}"
|
||||||
Text="{TemplateBinding Text}"
|
IsReadOnly="{TemplateBinding IsReadOnly}"
|
||||||
TextWrapping="NoWrap"
|
Text="{TemplateBinding Text}"
|
||||||
Watermark="{TemplateBinding Watermark}" />
|
TextWrapping="NoWrap"
|
||||||
</ButtonSpinner>
|
Watermark="{TemplateBinding Watermark}" />
|
||||||
|
</ButtonSpinner>
|
||||||
|
</DataValidationErrors>
|
||||||
</ControlTemplate>
|
</ControlTemplate>
|
||||||
</Setter>
|
</Setter>
|
||||||
|
|
||||||
<Style Selector="^.Large">
|
<Style Selector="^.Large /template/ TextBox#PART_TextBox">
|
||||||
<Setter Property="MinHeight" Value="{DynamicResource NumericUpDownWrapperLargeHeight}" />
|
<Setter Property="MinHeight" Value="{DynamicResource NumericUpDownWrapperLargeHeight}" />
|
||||||
</Style>
|
</Style>
|
||||||
<Style Selector="^.Small">
|
<Style Selector="^.Small /template/ TextBox#PART_TextBox">
|
||||||
<Setter Property="MinHeight" Value="{DynamicResource NumericUpDownWrapperSmallHeight}" />
|
<Setter Property="MinHeight" Value="{DynamicResource NumericUpDownWrapperSmallHeight}" />
|
||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
|
<Style Selector="^:error">
|
||||||
|
<Style Selector="^ /template/ TextBox#PART_TextBox">
|
||||||
|
<Setter Property="Background" Value="{DynamicResource DataValidationErrorsBackground}" />
|
||||||
|
<Setter Property="BorderBrush" Value="Transparent" />
|
||||||
|
</Style>
|
||||||
|
<Style Selector="^:pointerover /template/ TextBox#PART_TextBox">
|
||||||
|
<Setter Property="Background" Value="{DynamicResource DataValidationErrorsPointerOverBackground}" />
|
||||||
|
<Setter Property="BorderBrush" Value="Transparent" />
|
||||||
|
</Style>
|
||||||
|
<Style Selector="^:pressed /template/ TextBox#PART_TextBox">
|
||||||
|
<Setter Property="Background" Value="{DynamicResource DataValidationErrorsPressedBackground}" />
|
||||||
|
<Setter Property="BorderBrush" Value="Transparent" />
|
||||||
|
</Style>
|
||||||
|
<Style Selector="^:focus /template/ TextBox#PART_TextBox">
|
||||||
|
<Setter Property="Background" Value="{DynamicResource DataValidationErrorsSelectedBackground}" />
|
||||||
|
<Setter Property="BorderBrush" Value="{DynamicResource DataValidationErrorsSelectedBorderBrush}" />
|
||||||
|
</Style>
|
||||||
|
</Style>
|
||||||
</ControlTheme>
|
</ControlTheme>
|
||||||
|
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
Loading…
x
Reference in New Issue
Block a user