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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
7 additions and
2 deletions
-
src/Avalonia.Controls/Flyouts/MenuFlyoutPresenter.cs
-
src/Avalonia.Controls/MenuBase.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
|
|
|
|
|
|
|
|
@ -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)); |
|
|
|
} |
|
|
|
|