From f66a175abd1bcdebe2b30760c3b3b811b6fd4eb5 Mon Sep 17 00:00:00 2001 From: rabbitism Date: Thu, 27 Jun 2024 22:08:21 +0800 Subject: [PATCH] feat: make date two way by default. --- src/Ursa/Controls/DateTimePicker/DatePicker.cs | 3 ++- src/Ursa/Controls/DateTimePicker/DateRangePicker.cs | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Ursa/Controls/DateTimePicker/DatePicker.cs b/src/Ursa/Controls/DateTimePicker/DatePicker.cs index f81faff..7a33f98 100644 --- a/src/Ursa/Controls/DateTimePicker/DatePicker.cs +++ b/src/Ursa/Controls/DateTimePicker/DatePicker.cs @@ -3,6 +3,7 @@ using Avalonia; using Avalonia.Controls; using Avalonia.Controls.Metadata; using Avalonia.Controls.Primitives; +using Avalonia.Data; using Avalonia.Input; using Avalonia.Interactivity; using Irihi.Avalonia.Shared.Contracts; @@ -26,7 +27,7 @@ public class DatePicker: DatePickerBase, IClearControl private CalendarView? _calendar; public static readonly StyledProperty SelectedDateProperty = AvaloniaProperty.Register( - nameof(SelectedDate)); + nameof(SelectedDate), defaultBindingMode: BindingMode.TwoWay); public DateTime? SelectedDate { diff --git a/src/Ursa/Controls/DateTimePicker/DateRangePicker.cs b/src/Ursa/Controls/DateTimePicker/DateRangePicker.cs index fe87b7e..48b3758 100644 --- a/src/Ursa/Controls/DateTimePicker/DateRangePicker.cs +++ b/src/Ursa/Controls/DateTimePicker/DateRangePicker.cs @@ -3,6 +3,7 @@ using Avalonia; using Avalonia.Controls; using Avalonia.Controls.Metadata; using Avalonia.Controls.Primitives; +using Avalonia.Data; using Avalonia.Input; using Avalonia.Interactivity; using Irihi.Avalonia.Shared.Helpers; @@ -26,11 +27,11 @@ public class DateRangePicker : DatePickerBase public static readonly StyledProperty SelectedStartDateProperty = AvaloniaProperty.Register( - nameof(SelectedStartDate)); + nameof(SelectedStartDate), defaultBindingMode: BindingMode.TwoWay); public static readonly StyledProperty SelectedEndDateProperty = AvaloniaProperty.Register( - nameof(SelectedEndDate)); + nameof(SelectedEndDate), defaultBindingMode: BindingMode.TwoWay); public static readonly StyledProperty EnableMonthSyncProperty = AvaloniaProperty.Register( nameof(EnableMonthSync));