Skip to content

Commit

Permalink
[Windows] [Shell] Fix Flyout Background so it gets set in Locked beha…
Browse files Browse the repository at this point in the history
…vior mode (#6901)

* Update FlyoutBackdrop logic

* Fix FlyoutBackground on Locked issue

* Update ShellHandler.Windows.cs

* Update ShellView.cs

Co-authored-by: Shane Neuville <[email protected]>
  • Loading branch information
rachelkang and PureWeen authored May 7, 2022
1 parent 13df56c commit d20a808
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/Controls/src/Core/Handlers/Shell/ShellHandler.Windows.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,26 @@ protected override void ConnectHandler(ShellView platformView)
if (platformView is MauiNavigationView mauiNavigationView)
mauiNavigationView.OnApplyTemplateFinished += OnApplyTemplateFinished;

platformView.Loaded += OnLoaded;
platformView.PaneOpened += OnPaneOpened;
platformView.PaneOpening += OnPaneOpening;
platformView.PaneClosing += OnPaneClosing;
platformView.ItemInvoked += OnMenuItemInvoked;
}

private void OnLoaded(object sender, UI.Xaml.RoutedEventArgs e)
{
UpdateValue(nameof(Shell.FlyoutBackground));
}

protected override void DisconnectHandler(ShellView platformView)
{
base.DisconnectHandler(platformView);

if (platformView is MauiNavigationView mauiNavigationView)
mauiNavigationView.OnApplyTemplateFinished -= OnApplyTemplateFinished;

platformView.Loaded -= OnLoaded;
platformView.PaneOpened -= OnPaneOpened;
platformView.PaneOpening -= OnPaneOpening;
platformView.PaneClosing -= OnPaneClosing;
Expand Down
3 changes: 3 additions & 0 deletions src/Controls/src/Core/Handlers/Shell/Windows/ShellView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ void OnLoaded(object sender, RoutedEventArgs e)
// If we set it earlier than this then WinUI will transition it back to false
if (IsPaneOpen != Element.FlyoutIsPresented)
IsPaneOpen = Element.FlyoutIsPresented;

UpdateFlyoutBackdrop();
}

private protected override void UpdateFlyoutCustomContent()
Expand Down Expand Up @@ -70,6 +72,7 @@ private protected override void OnApplyTemplateCore()
TogglePaneButton?.SetAutomationPropertiesAutomationId("OK");

base.OnApplyTemplateCore();
UpdateFlyoutBackdrop();
}

internal void UpdateFlyoutPosition()
Expand Down

0 comments on commit d20a808

Please sign in to comment.