Table of Contents

Class Menu

Namespace
Avalonia.Controls
Assembly
Avalonia.Controls.dll

A top-level menu control.

public class Menu : MenuBase, INotifyPropertyChanged, IDataContextProvider, IThemeVariantHost, IResourceHost, IResourceNode, IStyleHost, ISetLogicalParent, ISetInheritanceParent, ISupportInitialize, IStyleable, INamed, IDataTemplateHost, ISetterValue, IChildIndexProvider, IFocusScope, IInputElement, ILogical
Inheritance
Menu
Implements
Inherited Members
Extension Methods

Constructors

Menu()

Initializes a new instance of the Menu class.

public Menu()

Menu(IMenuInteractionHandler)

Initializes a new instance of the Menu class.

public Menu(IMenuInteractionHandler interactionHandler)

Parameters

interactionHandler IMenuInteractionHandler

The menu interaction handler.

Methods

Close()

Closes the menu.

public override void Close()

OnAttachedToVisualTree(VisualTreeAttachmentEventArgs)

Called when the control is added to a rooted visual tree.

protected override void OnAttachedToVisualTree(VisualTreeAttachmentEventArgs e)

Parameters

e VisualTreeAttachmentEventArgs

The event args.

Open()

Opens the menu.

public override void Open()

PrepareContainerForItemOverride(Control, object?, int)

Prepares the specified element to display the specified item.

protected override void PrepareContainerForItemOverride(Control element, object? item, int index)

Parameters

element Control
item object

The item to display.

index int

The index of the item to display.