feat: add clear button to CalendarDatePicker. rename many resources.
This commit is contained in:
parent
385e1e2cd5
commit
90f982d673
@ -9,6 +9,7 @@
|
|||||||
mc:Ignorable="d">
|
mc:Ignorable="d">
|
||||||
<StackPanel HorizontalAlignment="Left" Spacing="20">
|
<StackPanel HorizontalAlignment="Left" Spacing="20">
|
||||||
<CalendarDatePicker />
|
<CalendarDatePicker />
|
||||||
|
<CalendarDatePicker Classes="ClearButton" Width="200" />
|
||||||
<CalendarDatePicker Width="500" />
|
<CalendarDatePicker Width="500" />
|
||||||
<CalendarDatePicker Classes="Large" />
|
<CalendarDatePicker Classes="Large" />
|
||||||
<CalendarDatePicker Classes="Small" />
|
<CalendarDatePicker Classes="Small" />
|
||||||
|
@ -205,7 +205,7 @@
|
|||||||
|
|
||||||
</ControlTheme>
|
</ControlTheme>
|
||||||
|
|
||||||
<ControlTheme x:Key="ButtonInputInnerButton" TargetType="Button">
|
<ControlTheme x:Key="InnerIconButton" TargetType="Button">
|
||||||
<Setter Property="Foreground" Value="{DynamicResource ButtonInputInnerForeground}" />
|
<Setter Property="Foreground" Value="{DynamicResource ButtonInputInnerForeground}" />
|
||||||
<Setter Property="Cursor" Value="Hand" />
|
<Setter Property="Cursor" Value="Hand" />
|
||||||
<Setter Property="Template">
|
<Setter Property="Template">
|
||||||
@ -214,6 +214,7 @@
|
|||||||
<PathIcon
|
<PathIcon
|
||||||
Width="16"
|
Width="16"
|
||||||
Height="16"
|
Height="16"
|
||||||
|
Margin="{TemplateBinding Padding}"
|
||||||
Data="{TemplateBinding Content}"
|
Data="{TemplateBinding Content}"
|
||||||
Foreground="{TemplateBinding Foreground}" />
|
Foreground="{TemplateBinding Foreground}" />
|
||||||
</ContentControl>
|
</ContentControl>
|
||||||
|
@ -3,26 +3,6 @@
|
|||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
x:CompileBindings="True">
|
x:CompileBindings="True">
|
||||||
<!-- Add Resources Here -->
|
<!-- Add Resources Here -->
|
||||||
<ControlTheme x:Key="CalendarDatePickerButton" TargetType="Button">
|
|
||||||
<Setter Property="Button.Foreground" Value="{DynamicResource CalendarDatePickerIconForeground}" />
|
|
||||||
<Setter Property="Button.Template">
|
|
||||||
<ControlTemplate TargetType="Button">
|
|
||||||
<Grid Margin="{TemplateBinding Padding}" Background="Transparent">
|
|
||||||
<PathIcon
|
|
||||||
Width="16"
|
|
||||||
Height="16"
|
|
||||||
Data="{DynamicResource CalendarDatePickerIconGlyph}"
|
|
||||||
Foreground="{TemplateBinding Foreground}" />
|
|
||||||
</Grid>
|
|
||||||
</ControlTemplate>
|
|
||||||
</Setter>
|
|
||||||
<Style Selector="^:pointerover /template/ PathIcon">
|
|
||||||
<Setter Property="Foreground" Value="{DynamicResource CalendarDatePickerIconPointeroverForeground}" />
|
|
||||||
</Style>
|
|
||||||
<Style Selector="^:pressed /template/ PathIcon">
|
|
||||||
<Setter Property="Foreground" Value="{DynamicResource CalendarDatePickerIconPointeroverForeground}" />
|
|
||||||
</Style>
|
|
||||||
</ControlTheme>
|
|
||||||
<ControlTheme x:Key="{x:Type CalendarDatePicker}" TargetType="CalendarDatePicker">
|
<ControlTheme x:Key="{x:Type CalendarDatePicker}" TargetType="CalendarDatePicker">
|
||||||
<Setter Property="Background" Value="{DynamicResource CalendarDatePickerBackground}" />
|
<Setter Property="Background" Value="{DynamicResource CalendarDatePickerBackground}" />
|
||||||
<Setter Property="Foreground" Value="{DynamicResource CalendarDatePickerForeground}" />
|
<Setter Property="Foreground" Value="{DynamicResource CalendarDatePickerForeground}" />
|
||||||
@ -51,10 +31,11 @@
|
|||||||
<Grid
|
<Grid
|
||||||
HorizontalAlignment="Stretch"
|
HorizontalAlignment="Stretch"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
ColumnDefinitions="*,Auto">
|
ColumnDefinitions="*, Auto, Auto">
|
||||||
<TextBox
|
<TextBox
|
||||||
Name="PART_TextBox"
|
Name="PART_TextBox"
|
||||||
Grid.Column="0"
|
Grid.Column="0"
|
||||||
|
Grid.ColumnSpan="2"
|
||||||
MinHeight="{DynamicResource CalendarDatePickerDefaultHeight}"
|
MinHeight="{DynamicResource CalendarDatePickerDefaultHeight}"
|
||||||
HorizontalAlignment="Stretch"
|
HorizontalAlignment="Stretch"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
@ -91,14 +72,24 @@
|
|||||||
</TextBox.Styles>
|
</TextBox.Styles>
|
||||||
</TextBox>
|
</TextBox>
|
||||||
<Button
|
<Button
|
||||||
Name="PART_Button"
|
Name="ClearButton"
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
Padding="0,0,8,0"
|
Padding="0,0,8,0"
|
||||||
Cursor="Hand"
|
Content="{DynamicResource TextBoxClearButtonData}"
|
||||||
|
Command="{Binding $parent[CalendarDatePicker].Clear}"
|
||||||
Focusable="False"
|
Focusable="False"
|
||||||
Theme="{DynamicResource CalendarDatePickerButton}" />
|
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
|
<Popup
|
||||||
Name="PART_Popup"
|
Name="PART_Popup"
|
||||||
|
Grid.Column="0"
|
||||||
HorizontalOffset="-8"
|
HorizontalOffset="-8"
|
||||||
IsLightDismissEnabled="True"
|
IsLightDismissEnabled="True"
|
||||||
PlacementTarget="{TemplateBinding}"
|
PlacementTarget="{TemplateBinding}"
|
||||||
@ -117,8 +108,8 @@
|
|||||||
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}" />
|
</Calendar>
|
||||||
</Border>
|
</Border>
|
||||||
</Popup>
|
</Popup>
|
||||||
</Grid>
|
</Grid>
|
||||||
@ -129,6 +120,12 @@
|
|||||||
|
|
||||||
</ControlTemplate>
|
</ControlTemplate>
|
||||||
</Setter>
|
</Setter>
|
||||||
|
|
||||||
|
<Style Selector="^.clearButton, ^.ClearButton">
|
||||||
|
<Style Selector="^:pointerover /template/ Button#ClearButton">
|
||||||
|
<Setter Property="IsVisible" Value="{Binding $parent[CalendarDatePicker].SelectedDate, Converter={x:Static ObjectConverters.IsNotNull}}"></Setter>
|
||||||
|
</Style>
|
||||||
|
</Style>
|
||||||
|
|
||||||
<Style Selector="^.Large">
|
<Style Selector="^.Large">
|
||||||
<Style Selector="^ /template/ TextBox#PART_TextBox">
|
<Style Selector="^ /template/ TextBox#PART_TextBox">
|
||||||
|
@ -80,7 +80,7 @@
|
|||||||
Content="{DynamicResource TextBoxClearButtonData}"
|
Content="{DynamicResource TextBoxClearButtonData}"
|
||||||
IsVisible="False"
|
IsVisible="False"
|
||||||
Command="{Binding $parent[ComboBox].Clear}"
|
Command="{Binding $parent[ComboBox].Clear}"
|
||||||
Theme="{DynamicResource ButtonInputInnerButton}" />
|
Theme="{DynamicResource InnerIconButton}" />
|
||||||
<Border
|
<Border
|
||||||
x:Name="DropDownOverlay"
|
x:Name="DropDownOverlay"
|
||||||
Grid.Column="2"
|
Grid.Column="2"
|
||||||
|
@ -232,7 +232,7 @@
|
|||||||
Command="{Binding $parent[DatePicker].Clear}"
|
Command="{Binding $parent[DatePicker].Clear}"
|
||||||
Content="{DynamicResource TextBoxClearButtonData}"
|
Content="{DynamicResource TextBoxClearButtonData}"
|
||||||
IsVisible="False"
|
IsVisible="False"
|
||||||
Theme="{DynamicResource ButtonInputInnerButton}" />
|
Theme="{DynamicResource InnerIconButton}" />
|
||||||
</Grid>
|
</Grid>
|
||||||
</DataValidationErrors>
|
</DataValidationErrors>
|
||||||
</ControlTemplate>
|
</ControlTemplate>
|
||||||
|
@ -255,7 +255,7 @@
|
|||||||
Command="{Binding $parent[TimePicker].Clear}"
|
Command="{Binding $parent[TimePicker].Clear}"
|
||||||
Content="{DynamicResource TextBoxClearButtonData}"
|
Content="{DynamicResource TextBoxClearButtonData}"
|
||||||
IsVisible="False"
|
IsVisible="False"
|
||||||
Theme="{DynamicResource ButtonInputInnerButton}" />
|
Theme="{DynamicResource InnerIconButton}" />
|
||||||
</Grid>
|
</Grid>
|
||||||
</DataValidationErrors>
|
</DataValidationErrors>
|
||||||
</ControlTemplate>
|
</ControlTemplate>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user