Browse Source
Fix datepicker not refreshing format when date format changes (#18599)
* fix DatePicker not refresh when MonthFormat or YearFormat changed
* use SetSelectedDateText instead
pull/18645/head
小松果
10 months ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with
8 additions and
0 deletions
-
src/Avalonia.Controls/DateTimePickers/DatePicker.cs
-
src/Avalonia.Controls/DateTimePickers/DatePickerPresenter.cs
|
|
|
@ -293,6 +293,10 @@ namespace Avalonia.Controls |
|
|
|
var (oldValue, newValue) = change.GetOldAndNewValue<DateTimeOffset?>(); |
|
|
|
OnSelectedDateChanged(this, new DatePickerSelectedValueChangedEventArgs(oldValue, newValue)); |
|
|
|
} |
|
|
|
else if (change.Property == MonthFormatProperty || change.Property == YearFormatProperty || change.Property == DayFormatProperty) |
|
|
|
{ |
|
|
|
SetSelectedDateText(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private void OnDismissPicker(object? sender, EventArgs e) |
|
|
|
|
|
|
|
@ -312,6 +312,10 @@ namespace Avalonia.Controls |
|
|
|
{ |
|
|
|
OnDateRangeChanged(this, change); |
|
|
|
} |
|
|
|
else if (change.Property == MonthFormatProperty || change.Property == YearFormatProperty || change.Property == DayFormatProperty) |
|
|
|
{ |
|
|
|
InitPicker(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
protected override void OnKeyDown(KeyEventArgs e) |
|
|
|
|