diff --git a/demo/Ursa.Demo/Pages/DatePickerDemo.axaml b/demo/Ursa.Demo/Pages/DatePickerDemo.axaml index 4a29a6a..358e74c 100644 --- a/demo/Ursa.Demo/Pages/DatePickerDemo.axaml +++ b/demo/Ursa.Demo/Pages/DatePickerDemo.axaml @@ -5,7 +5,7 @@ xmlns:u="https://irihi.tech/ursa" mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" x:Class="Ursa.Demo.Pages.DatePickerDemo"> - + @@ -30,5 +30,6 @@ + diff --git a/src/Ursa.Themes.Semi/Controls/Calendar.axaml b/src/Ursa.Themes.Semi/Controls/Calendar.axaml index 13830c1..50186f9 100644 --- a/src/Ursa.Themes.Semi/Controls/Calendar.axaml +++ b/src/Ursa.Themes.Semi/Controls/Calendar.axaml @@ -28,17 +28,19 @@ + + - - - - - + + + + + @@ -52,8 +54,8 @@ Name="PART_ContentPresenter" HorizontalAlignment="Center" VerticalAlignment="Center" - Foreground="{TemplateBinding Foreground}" - Content="1" /> + Content="{TemplateBinding Content}" + Foreground="{TemplateBinding Foreground}" /> @@ -64,19 +66,19 @@ - + - + @@ -87,7 +89,7 @@ @@ -113,22 +115,148 @@ - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Ursa/Controls/DateTimePicker/Calendar.cs b/src/Ursa/Controls/DateTimePicker/Calendar.cs index daceb40..4cdc3c3 100644 --- a/src/Ursa/Controls/DateTimePicker/Calendar.cs +++ b/src/Ursa/Controls/DateTimePicker/Calendar.cs @@ -1,12 +1,32 @@ using Avalonia; using Avalonia.Collections; +using Avalonia.Controls; +using Avalonia.Controls.Metadata; using Avalonia.Controls.Primitives; using Avalonia.Interactivity; namespace Ursa.Controls; +[TemplatePart(PART_NextYearButton, typeof(Button))] +[TemplatePart(PART_PreviousYearButton, typeof(Button))] +[TemplatePart(PART_NextButton, typeof(Button))] +[TemplatePart(PART_PreviousButton, typeof(Button))] +[TemplatePart(PART_HeaderButton, typeof(Button))] +[TemplatePart(PART_BackButton, typeof(Button))] +[TemplatePart(PART_MonthView, typeof(Panel))] +[TemplatePart(PART_YearView, typeof(Panel))] public class Calendar: TemplatedControl { + public const string PART_NextYearButton = "PART_NextYearButton"; + public const string PART_PreviousYearButton = "PART_PreviousYearButton"; + public const string PART_NextButton = "PART_NextButton"; + public const string PART_PreviousButton = "PART_PreviousButton"; + public const string PART_HeaderButton = "PART_HeaderButton"; + public const string PART_BackButton = "PART_BackButton"; + public const string PART_MonthView = "PART_MonthView"; + public const string PART_YearView = "PART_YearView"; + + public static readonly StyledProperty SelectedDateProperty = AvaloniaProperty.Register(nameof(SelectedDate), DateTime.Now); public DateTime SelectedDate { diff --git a/src/Ursa/Controls/DateTimePicker/CalendarDayButton.cs b/src/Ursa/Controls/DateTimePicker/CalendarDayButton.cs index 06ab696..8bdebec 100644 --- a/src/Ursa/Controls/DateTimePicker/CalendarDayButton.cs +++ b/src/Ursa/Controls/DateTimePicker/CalendarDayButton.cs @@ -99,6 +99,9 @@ public class CalendarDayButton: ContentControl } private bool _isBlackout; + /// + /// Notice: IsBlackout is not equivalent to not IsEnabled. Blackout dates still react to pointerover actions. + /// public bool IsBlackout { get => _isBlackout; @@ -117,7 +120,6 @@ public class CalendarDayButton: ContentControl protected override void OnApplyTemplate(TemplateAppliedEventArgs e) { base.OnApplyTemplate(e); - PseudoClasses.Set(PseudoClassName.PC_Disabled, IsEnabled); PseudoClasses.Set(PC_Today, IsToday); PseudoClasses.Set(PC_StartDate, IsStartDate); PseudoClasses.Set(PC_EndDate, IsEndDate);