feat: implement month syncing.

This commit is contained in:
rabbitism
2024-06-23 04:34:23 +08:00
parent c88258cdd5
commit d8119aaeaa
6 changed files with 90 additions and 30 deletions

View File

@@ -1,8 +1,9 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:u="https://irihi.tech/ursa">
<!-- Add Resources Here -->
<ControlTheme TargetType="u:DatePicker" x:Key="{x:Type u:DatePicker}">
<ResourceDictionary
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:u="https://irihi.tech/ursa">
<!-- Add Resources Here -->
<ControlTheme x:Key="{x:Type u:DatePicker}" TargetType="u:DatePicker">
<Setter Property="Background" Value="{DynamicResource CalendarDatePickerBackground}" />
<Setter Property="Foreground" Value="{DynamicResource CalendarDatePickerForeground}" />
<Setter Property="BorderBrush" Value="{DynamicResource CalendarDatePickerBorderBrush}" />
@@ -25,7 +26,7 @@
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding CornerRadius}"/>
CornerRadius="{TemplateBinding CornerRadius}" />
<Grid
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
@@ -40,20 +41,18 @@
Background="Transparent"
BorderBrush="Transparent"
BorderThickness="0"
Watermark="{TemplateBinding Watermark}"
InnerLeftContent="{TemplateBinding InnerLeftContent}"
InnerRightContent="{TemplateBinding InnerRightContent}"
CornerRadius="{TemplateBinding CornerRadius}"
Foreground="{TemplateBinding Foreground}"
InnerLeftContent="{TemplateBinding InnerLeftContent}"
InnerRightContent="{TemplateBinding InnerRightContent}"
Theme="{DynamicResource LooklessTextBox}"
>
</TextBox>
Watermark="{TemplateBinding Watermark}" />
<Button
Name="ClearButton"
Grid.Column="1"
Padding="0,0,8,0"
Content="{DynamicResource IconButtonClearData}"
Command="{Binding $parent[u:DatePicker].Clear}"
Content="{DynamicResource IconButtonClearData}"
Focusable="False"
IsVisible="False"
Theme="{DynamicResource InnerIconButton}" />
@@ -67,25 +66,25 @@
<Popup
Name="PART_Popup"
Grid.Column="0"
HorizontalOffset="-8"
HorizontalOffset="-4"
IsLightDismissEnabled="True"
PlacementTarget="{TemplateBinding}"
Placement="BottomEdgeAlignedLeft"
IsOpen="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=IsDropdownOpen, Mode=TwoWay}"
VerticalOffset="-4">
Placement="BottomEdgeAlignedLeft"
PlacementTarget="{TemplateBinding}">
<Border
Margin="8"
Padding="8"
Background="{DynamicResource SemiColorBackground0}"
BoxShadow="{DynamicResource CalendarDatePickerPopupBoxShadows}"
Background="{DynamicResource ComboBoxPopupBackground}"
BorderBrush="{DynamicResource ComboBoxPopupBorderBrush}"
BoxShadow="{DynamicResource ComboBoxPopupBoxShadow}"
BorderThickness="{DynamicResource ComboBoxPopupBorderThickness}"
CornerRadius="{DynamicResource CalendarCornerRadius}">
<u:CalendarView
Name="PART_Calendar"
BorderThickness="0"
CornerRadius="{Binding $parent[Border].CornerRadius}"
FirstDayOfWeek="{TemplateBinding FirstDayOfWeek}"
IsTodayHighlighted="{TemplateBinding IsTodayHighlighted}">
</u:CalendarView>
IsTodayHighlighted="{TemplateBinding IsTodayHighlighted}" />
</Border>
</Popup>
</Grid>

View File

@@ -72,21 +72,21 @@
</Grid>
<Popup
Name="{x:Static contracts:PartNames.PART_Popup}"
HorizontalOffset="-4"
IsLightDismissEnabled="True"
IsOpen="{TemplateBinding IsDropdownOpen,
Mode=TwoWay}"
Placement="BottomEdgeAlignedLeft"
PlacementTarget="Background">
<Border
Margin="0,4"
Margin="8"
Padding="8"
HorizontalAlignment="Stretch"
Background="{DynamicResource ComboBoxPopupBackground}"
BorderBrush="{DynamicResource ComboBoxPopupBorderBrush}"
BorderThickness="{DynamicResource ComboBoxPopupBorderThickness}"
BoxShadow="{DynamicResource ComboBoxPopupBoxShadow}"
ClipToBounds="True"
CornerRadius="6">
CornerRadius="{DynamicResource CalendarCornerRadius}">
<DockPanel>
<!--
<StackPanel DockPanel.Dock="Bottom" IsVisible="{TemplateBinding NeedConfirmation}">