-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Open
Labels
Description
Describe the bug
If CalendarDatePicker is closed programmaticale when SelectedDate changed, it becomes unusable because of closing automatically when pointing on date, but not clicking on it.
To Reproduce
This is a simple behavior to reproduce:
internal class CalendarDatePickerBehavior : Behavior<CalendarDatePicker>
{
protected override void OnAttached()
{
base.OnAttached();
AssociatedObject!.PropertyChanged += AssociatedObjectPropertyChanged;
}
private async void AssociatedObjectPropertyChanged(object? sender, AvaloniaPropertyChangedEventArgs e)
{
if (e.Property == CalendarDatePicker.SelectedDateProperty)
{
var w = new Window { Content = "Loading" };
w.Show();
await Task.Delay(100);
w.Close();
}
}
}
Expected behavior
No response
Avalonia version
11.2.5
OS
No response
Additional context
CalendarDatePickerBehavior imitates situation when selecting date starts some long operation with blocking modal window. When window is shown, CalendarDatePicker closes automatically. There's boolean flag _isMouseLeftButtonDown in class CalendarItem. It sets to true when user press on it (Cell_Click) and sets to false on release (Cell_MouseLeftButtonUp). But when window is shown, CalendareDatePicker closes before Cell_MouseLeftButtonUp call. So, the _isMouseLeftButtonDown left true permanently.
Reactions are currently unavailable