Browse Source

Merge pull request #8523 from pr8x/MenuFlyoutPresenter-custom-interaction-handler

Allow to pass custom `IMenuInteractionHandler` to `MenuFlyoutPresenter`
pull/8529/head
Max Katz 4 years ago
committed by GitHub
parent
commit
dcf973fc01
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      src/Avalonia.Controls/Flyouts/MenuFlyoutPresenter.cs
  2. 4
      src/Avalonia.Controls/MenuBase.cs

5
src/Avalonia.Controls/Flyouts/MenuFlyoutPresenter.cs

@ -11,9 +11,14 @@ namespace Avalonia.Controls
public MenuFlyoutPresenter()
:base(new DefaultMenuInteractionHandler(true))
{
}
public MenuFlyoutPresenter(IMenuInteractionHandler menuInteractionHandler)
: base(menuInteractionHandler)
{
}
public override void Close()
{
// DefaultMenuInteractionHandler calls this

4
src/Avalonia.Controls/MenuBase.cs

@ -40,7 +40,7 @@ namespace Avalonia.Controls
/// <summary>
/// Initializes a new instance of the <see cref="MenuBase"/> class.
/// </summary>
public MenuBase()
protected MenuBase()
{
InteractionHandler = new DefaultMenuInteractionHandler(false);
}
@ -49,7 +49,7 @@ namespace Avalonia.Controls
/// Initializes a new instance of the <see cref="MenuBase"/> class.
/// </summary>
/// <param name="interactionHandler">The menu interaction handler.</param>
public MenuBase(IMenuInteractionHandler interactionHandler)
protected MenuBase(IMenuInteractionHandler interactionHandler)
{
InteractionHandler = interactionHandler ?? throw new ArgumentNullException(nameof(interactionHandler));
}

Loading…
Cancel
Save