mirror of
https://gitcode.com/gh_mirrors/se/Semi.Avalonia
synced 2026-05-02 05:51:28 +08:00
feat: add validation errors to CalendarDatePicker.
This commit is contained in:
@@ -34,10 +34,10 @@
|
|||||||
<Setter Property="VerticalAlignment" Value="Center" />
|
<Setter Property="VerticalAlignment" Value="Center" />
|
||||||
<Setter Property="HorizontalContentAlignment" Value="Left" />
|
<Setter Property="HorizontalContentAlignment" Value="Left" />
|
||||||
<Setter Property="VerticalContentAlignment" Value="Center" />
|
<Setter Property="VerticalContentAlignment" Value="Center" />
|
||||||
<Setter Property="CalendarDatePicker.MinHeight" Value="{DynamicResource CalendarDatePickerDefaultHeight}" />
|
|
||||||
<Setter Property="Padding" Value="8 0" />
|
<Setter Property="Padding" Value="8 0" />
|
||||||
<Setter Property="Template">
|
<Setter Property="Template">
|
||||||
<ControlTemplate TargetType="CalendarDatePicker">
|
<ControlTemplate TargetType="CalendarDatePicker">
|
||||||
|
<DataValidationErrors>
|
||||||
<Panel
|
<Panel
|
||||||
x:Name="LayoutRoot"
|
x:Name="LayoutRoot"
|
||||||
HorizontalAlignment="Stretch"
|
HorizontalAlignment="Stretch"
|
||||||
@@ -55,7 +55,7 @@
|
|||||||
<TextBox
|
<TextBox
|
||||||
Name="PART_TextBox"
|
Name="PART_TextBox"
|
||||||
Grid.Column="0"
|
Grid.Column="0"
|
||||||
MinHeight="{DynamicResource CalendarDatePickerInnerDefaultHeight}"
|
MinHeight="{DynamicResource CalendarDatePickerDefaultHeight}"
|
||||||
HorizontalAlignment="Stretch"
|
HorizontalAlignment="Stretch"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
|
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||||
@@ -68,13 +68,15 @@
|
|||||||
UseFloatingWatermark="{TemplateBinding UseFloatingWatermark}"
|
UseFloatingWatermark="{TemplateBinding UseFloatingWatermark}"
|
||||||
Watermark="{TemplateBinding Watermark}">
|
Watermark="{TemplateBinding Watermark}">
|
||||||
<TextBox.Styles>
|
<TextBox.Styles>
|
||||||
<Style Selector="TextBox#PART_TextBox:pointerover /template/ Border#PART_ContentPresenterBorder">
|
<Style
|
||||||
|
Selector="TextBox#PART_TextBox:pointerover /template/ Border#PART_ContentPresenterBorder">
|
||||||
<!-- By default the TextBox has its own focused state, override this to disable it here -->
|
<!-- By default the TextBox has its own focused state, override this to disable it here -->
|
||||||
<Setter Property="Background" Value="Transparent" />
|
<Setter Property="Background" Value="Transparent" />
|
||||||
<Setter Property="BorderBrush" Value="Transparent" />
|
<Setter Property="BorderBrush" Value="Transparent" />
|
||||||
<Setter Property="BorderThickness" Value="0" />
|
<Setter Property="BorderThickness" Value="0" />
|
||||||
</Style>
|
</Style>
|
||||||
<Style Selector="TextBox#PART_TextBox:focus /template/ Border#PART_ContentPresenterBorder">
|
<Style
|
||||||
|
Selector="TextBox#PART_TextBox:focus /template/ Border#PART_ContentPresenterBorder">
|
||||||
<!-- By default the TextBox has its own focused state, override this to disable it here -->
|
<!-- By default the TextBox has its own focused state, override this to disable it here -->
|
||||||
<Setter Property="Background" Value="Transparent" />
|
<Setter Property="Background" Value="Transparent" />
|
||||||
<Setter Property="BorderBrush" Value="Transparent" />
|
<Setter Property="BorderBrush" Value="Transparent" />
|
||||||
@@ -116,14 +118,15 @@
|
|||||||
DisplayDateStart="{TemplateBinding DisplayDateStart}"
|
DisplayDateStart="{TemplateBinding DisplayDateStart}"
|
||||||
FirstDayOfWeek="{TemplateBinding FirstDayOfWeek}"
|
FirstDayOfWeek="{TemplateBinding FirstDayOfWeek}"
|
||||||
IsTodayHighlighted="{TemplateBinding IsTodayHighlighted}"
|
IsTodayHighlighted="{TemplateBinding IsTodayHighlighted}"
|
||||||
SelectedDate="{TemplateBinding SelectedDate,
|
SelectedDate="{TemplateBinding SelectedDate, Mode=TwoWay}" />
|
||||||
Mode=TwoWay}" />
|
|
||||||
</Border>
|
</Border>
|
||||||
</Popup>
|
</Popup>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Border>
|
</Border>
|
||||||
|
|
||||||
</Panel>
|
</Panel>
|
||||||
|
</DataValidationErrors>
|
||||||
|
|
||||||
</ControlTemplate>
|
</ControlTemplate>
|
||||||
</Setter>
|
</Setter>
|
||||||
|
|
||||||
@@ -166,6 +169,25 @@
|
|||||||
<Setter Property="BorderBrush" Value="{DynamicResource CalendarDatePickerFocusBorderBrush}" />
|
<Setter Property="BorderBrush" Value="{DynamicResource CalendarDatePickerFocusBorderBrush}" />
|
||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
|
<Style Selector="^:error">
|
||||||
|
<Style Selector="^ /template/ Border#Background">
|
||||||
|
<Setter Property="Background" Value="{DynamicResource DataValidationErrorsBackground}" />
|
||||||
|
<Setter Property="BorderBrush" Value="Transparent" />
|
||||||
|
</Style>
|
||||||
|
<Style Selector="^:pointerover /template/ Border#Background">
|
||||||
|
<Setter Property="Background" Value="{DynamicResource DataValidationErrorsPointerOverBackground}" />
|
||||||
|
<Setter Property="BorderBrush" Value="Transparent" />
|
||||||
|
</Style>
|
||||||
|
<Style Selector="^:pressed /template/ Border#Background">
|
||||||
|
<Setter Property="Background" Value="{DynamicResource DataValidationErrorsPressedBackground}" />
|
||||||
|
<Setter Property="BorderBrush" Value="Transparent" />
|
||||||
|
</Style>
|
||||||
|
<Style Selector="^:focus /template/ Border#Background">
|
||||||
|
<Setter Property="Background" Value="{DynamicResource DataValidationErrorsSelectedBackground}" />
|
||||||
|
<Setter Property="BorderBrush" Value="{DynamicResource DataValidationErrorsSelectedBorderBrush}" />
|
||||||
|
</Style>
|
||||||
|
</Style>
|
||||||
|
|
||||||
<Style Selector="^.Bordered">
|
<Style Selector="^.Bordered">
|
||||||
<Style Selector="^ Border#Background">
|
<Style Selector="^ Border#Background">
|
||||||
<Setter Property="Border.Background" Value="{DynamicResource CalendarDatePickerBorderedDefaultBackground}" />
|
<Setter Property="Border.Background" Value="{DynamicResource CalendarDatePickerBorderedDefaultBackground}" />
|
||||||
@@ -189,6 +211,24 @@
|
|||||||
<Setter Property="Foreground" Value="{DynamicResource CalendarDatePickerDisabledIconForeground}" />
|
<Setter Property="Foreground" Value="{DynamicResource CalendarDatePickerDisabledIconForeground}" />
|
||||||
</Style>
|
</Style>
|
||||||
</Style>
|
</Style>
|
||||||
|
<Style Selector="^:error">
|
||||||
|
<Style Selector="^ /template/ Border#Background">
|
||||||
|
<Setter Property="Background" Value="{DynamicResource DataValidationErrorsBackground}" />
|
||||||
|
<Setter Property="BorderBrush" Value="{DynamicResource DataValidationErrorsBorderBrush}" />
|
||||||
|
</Style>
|
||||||
|
<Style Selector="^:pointerover /template/ Border#Background">
|
||||||
|
<Setter Property="Border.Background" Value="{DynamicResource DataValidationErrorsPointerOverBackground}" />
|
||||||
|
<Setter Property="Border.BorderBrush" Value="{DynamicResource DataValidationErrorsPointerOverBorderBrush}" />
|
||||||
|
</Style>
|
||||||
|
<Style Selector="^:pressed /template/ Border#Background">
|
||||||
|
<Setter Property="Border.Background" Value="{DynamicResource DataValidationErrorsPressedBackground}" />
|
||||||
|
<Setter Property="Border.BorderBrush" Value="{DynamicResource DataValidationErrorsPressedBorderBrush}" />
|
||||||
|
</Style>
|
||||||
|
<Style Selector="^:focus /template/ Border#Background">
|
||||||
|
<Setter Property="Border.Background" Value="{DynamicResource DataValidationErrorsSelectedBackground}" />
|
||||||
|
<Setter Property="Border.BorderBrush" Value="{DynamicResource DataValidationErrorsSelectedBorderBrush}" />
|
||||||
|
</Style>
|
||||||
|
</Style>
|
||||||
</Style>
|
</Style>
|
||||||
</ControlTheme>
|
</ControlTheme>
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
|
|||||||
Reference in New Issue
Block a user