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