feat: remove Calendar BorderThickness.

This commit is contained in:
Zhang Dian 2024-12-02 16:49:05 +08:00
parent 2ce8bcdc1b
commit a909b6da6e
2 changed files with 14 additions and 33 deletions

View File

@ -95,7 +95,8 @@
Name="PART_MonthView" Name="PART_MonthView"
Grid.Row="1" Grid.Row="1"
HorizontalAlignment="Stretch" HorizontalAlignment="Stretch"
IsVisible="False"> IsVisible="False"
ColumnDefinitions="*,*,*,*,*,*,*">
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="{DynamicResource CalendarItemWeekDayNameHeight}" /> <RowDefinition Height="{DynamicResource CalendarItemWeekDayNameHeight}" />
<RowDefinition Height="*" /> <RowDefinition Height="*" />
@ -105,33 +106,14 @@
<RowDefinition Height="*" /> <RowDefinition Height="*" />
<RowDefinition Height="*" /> <RowDefinition Height="*" />
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
</Grid> </Grid>
<Grid <Grid
Name="PART_YearView" Name="PART_YearView"
Grid.Row="1" Grid.Row="1"
Background="{TemplateBinding Background}" Background="{TemplateBinding Background}"
IsVisible="False"> IsVisible="False"
<Grid.RowDefinitions> ColumnDefinitions="*,*,*,*"
<RowDefinition Height="*" /> RowDefinitions="*,*,*" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
</Grid>
</Grid> </Grid>
</Border> </Border>
</ControlTemplate> </ControlTemplate>
@ -151,6 +133,7 @@
<Setter Property="VerticalContentAlignment" Value="Center" /> <Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="HorizontalAlignment" Value="Stretch" /> <Setter Property="HorizontalAlignment" Value="Stretch" />
<Setter Property="VerticalAlignment" Value="Stretch" /> <Setter Property="VerticalAlignment" Value="Stretch" />
<Setter Property="Cursor" Value="Hand" />
<Setter Property="Template"> <Setter Property="Template">
<ControlTemplate TargetType="CalendarButton"> <ControlTemplate TargetType="CalendarButton">
<ContentControl <ContentControl
@ -211,6 +194,7 @@
<Setter Property="VerticalAlignment" Value="Stretch" /> <Setter Property="VerticalAlignment" Value="Stretch" />
<Setter Property="HorizontalContentAlignment" Value="Center" /> <Setter Property="HorizontalContentAlignment" Value="Center" />
<Setter Property="VerticalContentAlignment" Value="Center" /> <Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="Cursor" Value="Hand" />
<Setter Property="Template"> <Setter Property="Template">
<ControlTemplate TargetType="CalendarDayButton"> <ControlTemplate TargetType="CalendarDayButton">
<ContentControl <ContentControl

View File

@ -3,8 +3,8 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:CompileBindings="True"> x:CompileBindings="True">
<Design.PreviewWith> <Design.PreviewWith>
<StackPanel Margin="20" Width="300" Height="400"> <StackPanel Margin="20" Width="800" Height="400">
<CalendarDatePicker Classes="ClearButton" /> <CalendarDatePicker HorizontalAlignment="Center" Classes="ClearButton" />
</StackPanel> </StackPanel>
</Design.PreviewWith> </Design.PreviewWith>
<ControlTheme x:Key="{x:Type CalendarDatePicker}" TargetType="CalendarDatePicker"> <ControlTheme x:Key="{x:Type CalendarDatePicker}" TargetType="CalendarDatePicker">
@ -96,25 +96,22 @@
<Popup <Popup
Name="PART_Popup" Name="PART_Popup"
Grid.Column="0" Grid.Column="0"
HorizontalOffset="-8"
IsLightDismissEnabled="True" IsLightDismissEnabled="True"
PlacementTarget="{TemplateBinding}" Placement="BottomEdgeAlignedLeft"
VerticalOffset="-4"> PlacementTarget="{TemplateBinding}">
<Border <Border
Margin="8" Margin="4"
Background="Transparent" BorderThickness="0"
BoxShadow="{DynamicResource CalendarDatePickerPopupBoxShadows}" BoxShadow="{DynamicResource CalendarDatePickerPopupBoxShadows}"
CornerRadius="{DynamicResource CalendarCornerRadius}"> CornerRadius="{DynamicResource CalendarCornerRadius}">
<Calendar <Calendar
Name="PART_Calendar" Name="PART_Calendar"
CornerRadius="{Binding $parent[Border].CornerRadius}"
DisplayDate="{TemplateBinding DisplayDate}" DisplayDate="{TemplateBinding DisplayDate}"
DisplayDateEnd="{TemplateBinding DisplayDateEnd}" DisplayDateEnd="{TemplateBinding DisplayDateEnd}"
DisplayDateStart="{TemplateBinding DisplayDateStart}" DisplayDateStart="{TemplateBinding DisplayDateStart}"
FirstDayOfWeek="{TemplateBinding FirstDayOfWeek}" FirstDayOfWeek="{TemplateBinding FirstDayOfWeek}"
IsTodayHighlighted="{TemplateBinding IsTodayHighlighted}" IsTodayHighlighted="{TemplateBinding IsTodayHighlighted}"
SelectedDate="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=SelectedDate, Mode=TwoWay}"> SelectedDate="{TemplateBinding SelectedDate, Mode=TwoWay}" />
</Calendar>
</Border> </Border>
</Popup> </Popup>
</Grid> </Grid>