feat: Add bordered style for calendar datepicker.

This commit is contained in:
rabbitism 2023-02-15 17:38:31 +08:00
parent 46efeebf76
commit 07debbb6f4
5 changed files with 43 additions and 2 deletions

View File

@ -17,7 +17,10 @@
<Setter Property="Width" Value="300" /> <Setter Property="Width" Value="300" />
</Style> </Style>
</StackPanel.Styles> </StackPanel.Styles>
<AutoCompleteBox Items="{Binding States}" ValueMemberBinding="{Binding Name, x:DataType=local:StateData}"> <AutoCompleteBox
Items="{Binding States}"
ValueMemberBinding="{Binding Name, x:DataType=local:StateData}"
Watermark="Please select a State">
<AutoCompleteBox.ItemTemplate> <AutoCompleteBox.ItemTemplate>
<DataTemplate DataType="local:StateData"> <DataTemplate DataType="local:StateData">
<TextBlock Text="{Binding Name}" /> <TextBlock Text="{Binding Name}" />
@ -57,7 +60,8 @@
<AutoCompleteBox <AutoCompleteBox
IsEnabled="False" IsEnabled="False"
Items="{Binding States}" Items="{Binding States}"
ValueMemberBinding="{Binding Name, x:DataType=local:StateData}"> ValueMemberBinding="{Binding Name, x:DataType=local:StateData}"
Watermark="Disabled">
<AutoCompleteBox.ItemTemplate> <AutoCompleteBox.ItemTemplate>
<DataTemplate DataType="local:StateData"> <DataTemplate DataType="local:StateData">
<TextBlock Text="{Binding Name}" /> <TextBlock Text="{Binding Name}" />

View File

@ -23,5 +23,7 @@
<CalendarDatePicker Margin="0,0,0,8" Watermark="Watermark" /> <CalendarDatePicker Margin="0,0,0,8" Watermark="Watermark" />
<CalendarDatePicker IsEnabled="False" /> <CalendarDatePicker IsEnabled="False" />
<CalendarDatePicker Classes="Bordered" />
<CalendarDatePicker Classes="Bordered" IsEnabled="False" />
</StackPanel> </StackPanel>
</UserControl> </UserControl>

View File

@ -159,5 +159,30 @@
<Style Selector="^:focus-within /template/ Border#Background"> <Style Selector="^:focus-within /template/ Border#Background">
<Setter Property="BorderBrush" Value="{DynamicResource CalendarDatePickerFocusBorderBrush}" /> <Setter Property="BorderBrush" Value="{DynamicResource CalendarDatePickerFocusBorderBrush}" />
</Style> </Style>
<Style Selector="^.Bordered">
<Style Selector="^ Border#Background">
<Setter Property="Border.Background" Value="{DynamicResource CalendarDatePickerBorderedDefaultBackground}" />
<Setter Property="Border.BorderBrush" Value="{DynamicResource CalendarDatePickerBorderedDefaultBorderBrush}" />
</Style>
<Style Selector="^:pointerover /template/ Border#Background">
<Setter Property="Border.Background" Value="{DynamicResource CalendarDatePickerBorderedPointeroverBackground}" />
<Setter Property="Border.BorderBrush" Value="{DynamicResource CalendarDatePickerBorderedPointeroverBorderBrush}" />
</Style>
<Style Selector="^:focus-within /template/ Border#Background">
<Setter Property="Border.Background" Value="{DynamicResource CalendarDatePickerBorderedPointeroverBackground}" />
<Setter Property="Border.BorderBrush" Value="{DynamicResource CalendarDatePickerBorderedPointeroverBorderBrush}" />
</Style>
<Style Selector="^:disabled">
<Style Selector="^ /template/ Border#Background">
<Setter Property="Background" Value="{DynamicResource CalendarDatePickerDisabledBackground}" />
<Setter Property="Border.BorderBrush" Value="Transparent" />
</Style>
<Style Selector="^ /template/ Button#PART_Button">
<Setter Property="Foreground" Value="{DynamicResource CalendarDatePickerDisabledIconForeground}" />
</Style>
</Style>
</Style>
</ControlTheme> </ControlTheme>
</ResourceDictionary> </ResourceDictionary>

View File

@ -20,4 +20,9 @@
<x:Double x:Key="CalendarDatePickerDefaultHeight">32</x:Double> <x:Double x:Key="CalendarDatePickerDefaultHeight">32</x:Double>
<x:Double x:Key="CalendarDatePickerSmallHeight">24</x:Double> <x:Double x:Key="CalendarDatePickerSmallHeight">24</x:Double>
<x:Double x:Key="CalendarDatePickerLargeHeight">40</x:Double> <x:Double x:Key="CalendarDatePickerLargeHeight">40</x:Double>
<SolidColorBrush x:Key="CalendarDatePickerBorderedDefaultBackground" Color="Transparent" />
<SolidColorBrush x:Key="CalendarDatePickerBorderedDefaultBorderBrush" Opacity="0.12" Color="White" />
<SolidColorBrush x:Key="CalendarDatePickerBorderedPointeroverBackground" Color="Transparent" />
<SolidColorBrush x:Key="CalendarDatePickerBorderedPointeroverBorderBrush" Color="#0062D6" />
</ResourceDictionary> </ResourceDictionary>

View File

@ -19,4 +19,9 @@
<x:Double x:Key="CalendarDatePickerDefaultHeight">32</x:Double> <x:Double x:Key="CalendarDatePickerDefaultHeight">32</x:Double>
<x:Double x:Key="CalendarDatePickerSmallHeight">24</x:Double> <x:Double x:Key="CalendarDatePickerSmallHeight">24</x:Double>
<x:Double x:Key="CalendarDatePickerLargeHeight">40</x:Double> <x:Double x:Key="CalendarDatePickerLargeHeight">40</x:Double>
<SolidColorBrush x:Key="CalendarDatePickerBorderedDefaultBackground" Color="Transparent" />
<SolidColorBrush x:Key="CalendarDatePickerBorderedDefaultBorderBrush" Opacity="0.08" Color="#FF1C1F23" />
<SolidColorBrush x:Key="CalendarDatePickerBorderedPointeroverBackground" Color="Transparent" />
<SolidColorBrush x:Key="CalendarDatePickerBorderedPointeroverBorderBrush" Color="#0062D6" />
</ResourceDictionary> </ResourceDictionary>