Skip to content

Commit

Permalink
update: use hide method instead of IsOpen property
Browse files Browse the repository at this point in the history
  • Loading branch information
emako committed Aug 15, 2024
1 parent 23836e0 commit dd616b4
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/Wpf.Ui.Violeta/Controls/Flyout/FlyoutService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,18 @@ public static void ShowFlyout(FrameworkElement buttonExpected)
}
}

public static void HideFlyout(FrameworkElement buttonExpected)
{
if (GetFlyout(buttonExpected) is Flyout flyout)
{
if (flyout.GetTemplateChild("PART_Popup") is System.Windows.Controls.Primitives.Popup popup)
{
// Spoof the flyout opening state.
flyout.IsOpen = popup.IsOpen = false;
}
}
}

private static DependencyObject? GetTemplateChild(this FrameworkElement self, string childName)
{
MethodInfo? method = typeof(FrameworkElement)
Expand Down

0 comments on commit dd616b4

Please sign in to comment.