feat: fix date range start selection when tab into the control.

This commit is contained in:
rabbitism
2024-12-19 21:56:03 +08:00
parent fe631d70dd
commit ba981cd8ac

View File

@@ -457,5 +457,32 @@ public class DateRangePicker : DatePickerBase, IClearControl
break;
}
}
protected override void OnGotFocus(GotFocusEventArgs e)
{
base.OnGotFocus(e);
FocusChanged(IsKeyboardFocusWithin);
}
private bool _isFocused;
private void FocusChanged(bool hasFocus)
{
// The OnGotFocus & OnLostFocus are asynchronously and cannot
// reliably tell you that have the focus. All they do is let you
// know that the focus changed sometime in the past. To determine
// if you currently have the focus you need to do consult the
// FocusManager.
bool wasFocused = _isFocused;
_isFocused = hasFocus;
if (hasFocus)
{
if (!wasFocused && _start == null)
{
_start = true;
}
}
}
}