code cleanup.

This commit is contained in:
Tig
2024-08-29 15:57:18 -04:00
parent 760455806c
commit 3c714d603e

View File

@@ -320,24 +320,26 @@ public partial class View // Focus and cross-view navigation management (TabStop
{
set
{
if (HasFocus != value)
if (HasFocus == value)
{
if (value)
{
// NOTE: If Application.Navigation is null, we pass null to FocusChanging. For unit tests.
(bool focusSet, bool _) = SetHasFocusTrue (Application.Navigation?.GetFocused ());
return;
}
if (focusSet)
{
// The change happened
// HasFocus is now true
}
}
else
if (value)
{
// NOTE: If Application.Navigation is null, we pass null to FocusChanging. For unit tests.
(bool focusSet, bool _) = SetHasFocusTrue (Application.Navigation?.GetFocused ());
if (focusSet)
{
SetHasFocusFalse (null);
// The change happened
// HasFocus is now true
}
}
else
{
SetHasFocusFalse (null);
}
}
get => _hasFocus;
}