feat: redesign CalendarDatePicker.
This commit is contained in:
parent
833ccadb58
commit
71e276d478
@ -9,6 +9,7 @@
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource CalendarDatePickerBorderBrush}" />
|
||||
<Setter Property="BorderThickness" Value="{DynamicResource CalendarDatePickerBorderThickness}" />
|
||||
<Setter Property="CornerRadius" Value="{DynamicResource CalendarDatePickerCornerRadius}" />
|
||||
<Setter Property="BackgroundSizing" Value="InnerBorderEdge"/>
|
||||
<Setter Property="IsTodayHighlighted" Value="True" />
|
||||
<Setter Property="HorizontalAlignment" Value="Left" />
|
||||
<Setter Property="VerticalAlignment" Value="Center" />
|
||||
@ -24,96 +25,96 @@
|
||||
VerticalAlignment="Stretch">
|
||||
<Border
|
||||
x:Name="Background"
|
||||
BackgroundSizing="{TemplateBinding BackgroundSizing}"
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
CornerRadius="{TemplateBinding CornerRadius}">
|
||||
<Grid
|
||||
CornerRadius="{TemplateBinding CornerRadius}"/>
|
||||
<Grid
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Stretch"
|
||||
ColumnDefinitions="*, Auto, Auto">
|
||||
<TextBox
|
||||
Name="PART_TextBox"
|
||||
Grid.Column="0"
|
||||
Grid.ColumnSpan="2"
|
||||
MinHeight="{DynamicResource CalendarDatePickerDefaultHeight}"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Center"
|
||||
ColumnDefinitions="*, Auto, Auto">
|
||||
<TextBox
|
||||
Name="PART_TextBox"
|
||||
Grid.Column="0"
|
||||
Grid.ColumnSpan="2"
|
||||
MinHeight="{DynamicResource CalendarDatePickerDefaultHeight}"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
VerticalAlignment="Stretch"
|
||||
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
Background="Transparent"
|
||||
BorderBrush="Transparent"
|
||||
BorderThickness="0"
|
||||
CornerRadius="{TemplateBinding CornerRadius}"
|
||||
Foreground="{TemplateBinding Foreground}"
|
||||
Theme="{DynamicResource NonErrorTextBox}"
|
||||
UseFloatingWatermark="{TemplateBinding UseFloatingWatermark}"
|
||||
Watermark="{TemplateBinding Watermark}">
|
||||
<TextBox.Styles>
|
||||
<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 -->
|
||||
<Setter Property="Background" Value="Transparent" />
|
||||
<Setter Property="BorderBrush" Value="Transparent" />
|
||||
<Setter Property="BorderThickness" Value="0" />
|
||||
</Style>
|
||||
<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 -->
|
||||
<Setter Property="Background" Value="Transparent" />
|
||||
<Setter Property="BorderBrush" Value="Transparent" />
|
||||
<Setter Property="BorderThickness" Value="0" />
|
||||
</Style>
|
||||
<Style Selector="TextBox#PART_TextBox:disabled">
|
||||
<Style Selector="^ /template/ Border#PART_ContentPresenterBorder">
|
||||
<!-- By default the TextBox has its own disabled state, override this to make the border background show through -->
|
||||
<Setter Property="Background" Value="Transparent" />
|
||||
<Setter Property="BorderBrush" Value="Transparent" />
|
||||
</Style>
|
||||
</Style>
|
||||
</TextBox.Styles>
|
||||
</TextBox>
|
||||
<Button
|
||||
Name="ClearButton"
|
||||
Grid.Column="1"
|
||||
Padding="0,0,8,0"
|
||||
Content="{DynamicResource IconButtonClearData}"
|
||||
Command="{Binding $parent[CalendarDatePicker].Clear}"
|
||||
Focusable="False"
|
||||
IsVisible="False"
|
||||
Theme="{DynamicResource InnerIconButton}" />
|
||||
<Button
|
||||
Name="PART_Button"
|
||||
Grid.Column="2"
|
||||
Padding="0,0,8,0"
|
||||
Content="{DynamicResource CalendarDatePickerIconGlyph}"
|
||||
Focusable="False"
|
||||
Theme="{DynamicResource InnerIconButton}" />
|
||||
<Popup
|
||||
Name="PART_Popup"
|
||||
Grid.Column="0"
|
||||
HorizontalOffset="-8"
|
||||
IsLightDismissEnabled="True"
|
||||
PlacementTarget="{TemplateBinding}"
|
||||
VerticalOffset="-4">
|
||||
<Border
|
||||
Margin="8"
|
||||
Background="Transparent"
|
||||
BorderBrush="Transparent"
|
||||
BorderThickness="0"
|
||||
CornerRadius="{TemplateBinding CornerRadius}"
|
||||
Foreground="{TemplateBinding Foreground}"
|
||||
Theme="{DynamicResource NonErrorTextBox}"
|
||||
UseFloatingWatermark="{TemplateBinding UseFloatingWatermark}"
|
||||
Watermark="{TemplateBinding Watermark}">
|
||||
<TextBox.Styles>
|
||||
<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 -->
|
||||
<Setter Property="Background" Value="Transparent" />
|
||||
<Setter Property="BorderBrush" Value="Transparent" />
|
||||
<Setter Property="BorderThickness" Value="0" />
|
||||
</Style>
|
||||
<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 -->
|
||||
<Setter Property="Background" Value="Transparent" />
|
||||
<Setter Property="BorderBrush" Value="Transparent" />
|
||||
<Setter Property="BorderThickness" Value="0" />
|
||||
</Style>
|
||||
<Style Selector="TextBox#PART_TextBox:disabled">
|
||||
<Style Selector="^ /template/ Border#PART_ContentPresenterBorder">
|
||||
<!-- By default the TextBox has its own disabled state, override this to make the border background show through -->
|
||||
<Setter Property="Background" Value="Transparent" />
|
||||
<Setter Property="BorderBrush" Value="Transparent" />
|
||||
</Style>
|
||||
</Style>
|
||||
</TextBox.Styles>
|
||||
</TextBox>
|
||||
<Button
|
||||
Name="ClearButton"
|
||||
Grid.Column="1"
|
||||
Padding="0,0,8,0"
|
||||
Content="{DynamicResource IconButtonClearData}"
|
||||
Command="{Binding $parent[CalendarDatePicker].Clear}"
|
||||
Focusable="False"
|
||||
IsVisible="False"
|
||||
Theme="{DynamicResource InnerIconButton}" />
|
||||
<Button
|
||||
Name="PART_Button"
|
||||
Grid.Column="2"
|
||||
Padding="0,0,8,0"
|
||||
Content="{DynamicResource CalendarDatePickerIconGlyph}"
|
||||
Focusable="False"
|
||||
Theme="{DynamicResource InnerIconButton}" />
|
||||
<Popup
|
||||
Name="PART_Popup"
|
||||
Grid.Column="0"
|
||||
HorizontalOffset="-8"
|
||||
IsLightDismissEnabled="True"
|
||||
PlacementTarget="{TemplateBinding}"
|
||||
VerticalOffset="-4">
|
||||
<Border
|
||||
Margin="8"
|
||||
Background="Transparent"
|
||||
BoxShadow="{DynamicResource CalendarDatePickerPopupBoxShadows}"
|
||||
CornerRadius="{DynamicResource CalendarCornerRadius}">
|
||||
<Calendar
|
||||
Name="PART_Calendar"
|
||||
BorderThickness="0"
|
||||
CornerRadius="{Binding $parent[Border].CornerRadius}"
|
||||
DisplayDate="{TemplateBinding DisplayDate}"
|
||||
DisplayDateEnd="{TemplateBinding DisplayDateEnd}"
|
||||
DisplayDateStart="{TemplateBinding DisplayDateStart}"
|
||||
FirstDayOfWeek="{TemplateBinding FirstDayOfWeek}"
|
||||
IsTodayHighlighted="{TemplateBinding IsTodayHighlighted}"
|
||||
SelectedDate="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=SelectedDate, Mode=TwoWay}">
|
||||
</Calendar>
|
||||
</Border>
|
||||
</Popup>
|
||||
</Grid>
|
||||
</Border>
|
||||
BoxShadow="{DynamicResource CalendarDatePickerPopupBoxShadows}"
|
||||
CornerRadius="{DynamicResource CalendarCornerRadius}">
|
||||
<Calendar
|
||||
Name="PART_Calendar"
|
||||
BorderThickness="0"
|
||||
CornerRadius="{Binding $parent[Border].CornerRadius}"
|
||||
DisplayDate="{TemplateBinding DisplayDate}"
|
||||
DisplayDateEnd="{TemplateBinding DisplayDateEnd}"
|
||||
DisplayDateStart="{TemplateBinding DisplayDateStart}"
|
||||
FirstDayOfWeek="{TemplateBinding FirstDayOfWeek}"
|
||||
IsTodayHighlighted="{TemplateBinding IsTodayHighlighted}"
|
||||
SelectedDate="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=SelectedDate, Mode=TwoWay}">
|
||||
</Calendar>
|
||||
</Border>
|
||||
</Popup>
|
||||
</Grid>
|
||||
|
||||
</Panel>
|
||||
</DataValidationErrors>
|
||||
|
@ -2,7 +2,7 @@
|
||||
<PathGeometry x:Key="CalendarDatePickerIconGlyph">M4 20V8H20V20H4ZM2 4C2 2.89543 2.89543 2 4 2H20C21.1046 2 22 2.89543 22 4V20C22 21.1046 21.1046 22 20 22H4C2.89543 22 2 21.1046 2 20V4ZM6 10.5C6 10.2239 6.22386 10 6.5 10H8.5C8.77614 10 9 10.2239 9 10.5V12.5C9 12.7761 8.77614 13 8.5 13H6.5C6.22386 13 6 12.7761 6 12.5V10.5ZM6.5 15C6.22386 15 6 15.2239 6 15.5V17.5C6 17.7761 6.22386 18 6.5 18H8.5C8.77614 18 9 17.7761 9 17.5V15.5C9 15.2239 8.77614 15 8.5 15H6.5ZM10.5 10.5C10.5 10.2239 10.7239 10 11 10H13C13.2761 10 13.5 10.2239 13.5 10.5V12.5C13.5 12.7761 13.2761 13 13 13H11C10.7239 13 10.5 12.7761 10.5 12.5V10.5ZM11 15C10.7239 15 10.5 15.2239 10.5 15.5V17.5C10.5 17.7761 10.7239 18 11 18H13C13.2761 18 13.5 17.7761 13.5 17.5V15.5C13.5 15.2239 13.2761 15 13 15H11ZM15 10.5C15 10.2239 15.2239 10 15.5 10H17.5C17.7761 10 18 10.2239 18 10.5V12.5C18 12.7761 17.7761 13 17.5 13H15.5C15.2239 13 15 12.7761 15 12.5V10.5ZM15.5 15C15.2239 15 15 15.2239 15 15.5V17.5C15 17.7761 15.2239 18 15.5 18H17.5C17.7761 18 18 17.7761 18 17.5V15.5C18 15.2239 17.7761 15 17.5 15H15.5Z</PathGeometry>
|
||||
<Thickness x:Key="CalendarDatePickerBorderThickness">1</Thickness>
|
||||
<CornerRadius x:Key="CalendarDatePickerCornerRadius">3</CornerRadius>
|
||||
<x:Double x:Key="CalendarDatePickerInnerSmallHeight">22</x:Double>
|
||||
<x:Double x:Key="CalendarDatePickerInnerLargeHeight">38</x:Double>
|
||||
<x:Double x:Key="CalendarDatePickerInnerSmallHeight">24</x:Double>
|
||||
<x:Double x:Key="CalendarDatePickerInnerLargeHeight">40</x:Double>
|
||||
<x:Double x:Key="CalendarDatePickerDefaultHeight">32</x:Double>
|
||||
</ResourceDictionary>
|
Loading…
x
Reference in New Issue
Block a user