Fix Win10 SearchBar Flyout stays open-misplaced on taskbar click
MODIFY
WalletWasabi.Fluent/Behaviors/SearchBarBehavior.cs
WalletWasabi.Fluent/Behaviors/SearchBarBehavior.cs
@@ -50,13 +50,27 @@ public class SearchBarBehavior : AttachedToVisualTreeBehavior<Control>
return;
}
- if (AssociatedObject.GetVisualRoot() is TopLevel topLevel)
+ var visualRoot = AssociatedObject.GetVisualRoot();
+
+ if (visualRoot is TopLevel topLevel)
{
topLevel
.AddDisposableHandler(InputElement.PointerPressedEvent, OnTopLevelPointerPressed, RoutingStrategies.Tunnel)
.DisposeWith(disposables);
}
+ if (visualRoot is WindowBase window)
+ {
+ Observable
+ .FromEventPattern(window, nameof(WindowBase.Deactivated))
+ .Subscribe(_ =>
+ {
+ FocusManager.Instance?.Focus(null);
+ HideFlyout();
+ })
+ .DisposeWith(disposables);
+ }
+
if (SearchBox is { } && SearchPanel is { })
{
Observable
@@ -94,8 +108,6 @@ public class SearchBarBehavior : AttachedToVisualTreeBehavior<Control>
{
FlyoutBase.ShowAttachedFlyout(AssociatedObject);
}
-
- IsSearchPanelOpen = true;
}
private void AssociatedObjectOnLostFocus()
@@ -115,7 +127,6 @@ public class SearchBarBehavior : AttachedToVisualTreeBehavior<Control>
}
FlyoutBase.GetAttachedFlyout(AssociatedObject)?.Hide();
- IsSearchPanelOpen = false;
}
private void OnTopLevelPointerPressed(object? sender, PointerPressedEventArgs e)

Fix Win10 SearchBar Flyout stays open-misplaced on taskbar click