fix: minor fix for datepicker, simplify code.
This commit is contained in:
@@ -203,10 +203,8 @@ public class DatePicker: DatePickerBase, IClearControl
|
||||
FocusChanged(IsKeyboardFocusWithin);
|
||||
var top = TopLevel.GetTopLevel(this);
|
||||
var element = top?.FocusManager?.GetFocusedElement();
|
||||
if (element is Visual v && _popup?.IsInsidePopup(v)==true)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (element is Visual v && _popup?.IsInsidePopup(v) == true)return;
|
||||
if (Equals(element, _textBox))return;
|
||||
CommitInput(true);
|
||||
SetCurrentValue(IsDropdownOpenProperty, false);
|
||||
}
|
||||
|
||||
@@ -487,7 +487,7 @@ public class DateRangePicker : DatePickerBase, IClearControl
|
||||
return;
|
||||
}
|
||||
|
||||
if (element == _startTextBox || element == _endTextBox)
|
||||
if (Equals(element, _startTextBox) || Equals(element, _endTextBox))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -234,7 +234,7 @@ public class DateTimePicker : DatePickerBase
|
||||
return;
|
||||
}
|
||||
|
||||
if (element == _textBox)
|
||||
if (Equals(element, _textBox))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -222,7 +222,7 @@ public class TimePicker : TimePickerBase, IClearControl
|
||||
var top = TopLevel.GetTopLevel(this);
|
||||
var element = top?.FocusManager?.GetFocusedElement();
|
||||
if (element is Visual v && _popup?.IsInsidePopup(v) == true) return;
|
||||
if (element == _textBox) return;
|
||||
if (Equals(element, _textBox)) return;
|
||||
CommitInput(true);
|
||||
SetCurrentValue(IsDropdownOpenProperty, false);
|
||||
}
|
||||
|
||||
@@ -277,7 +277,7 @@ public class TimeRangePicker : TimePickerBase, IClearControl
|
||||
var top = TopLevel.GetTopLevel(this);
|
||||
var element = top?.FocusManager?.GetFocusedElement();
|
||||
if (element is Visual v && _popup?.IsInsidePopup(v) == true) return;
|
||||
if (element == _startTextBox || element == _endTextBox) return;
|
||||
if (Equals(element, _startTextBox) || Equals(element, _endTextBox)) return;
|
||||
CommitInput(true);
|
||||
SetCurrentValue(IsDropdownOpenProperty, false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user