Table of Contents

Class NativeMenu

Namespace
Avalonia.Controls
Assembly
Avalonia.Controls.dll
public class NativeMenu : AvaloniaObject, INotifyPropertyChanged, IEnumerable<NativeMenuItemBase>, IEnumerable, INativeMenuExporterEventsImplBridge
Inheritance
NativeMenu
Implements
Inherited Members

Constructors

NativeMenu()

public NativeMenu()

Fields

IsNativeMenuExportedProperty

public static readonly AttachedProperty<bool> IsNativeMenuExportedProperty

Field Value

AttachedProperty<bool>

MenuProperty

public static readonly AttachedProperty<NativeMenu?> MenuProperty

Field Value

AttachedProperty<NativeMenu>

ParentProperty

public static readonly DirectProperty<NativeMenu, NativeMenuItem?> ParentProperty

Field Value

DirectProperty<NativeMenu, NativeMenuItem>

Properties

Items

[Content]
public IList<NativeMenuItemBase> Items { get; }

Property Value

IList<NativeMenuItemBase>

Parent

public NativeMenuItem? Parent { get; }

Property Value

NativeMenuItem

Methods

Add(NativeMenuItemBase)

public void Add(NativeMenuItemBase item)

Parameters

item NativeMenuItemBase

GetEnumerator()

public IEnumerator<NativeMenuItemBase> GetEnumerator()

Returns

IEnumerator<NativeMenuItemBase>

GetIsNativeMenuExported(TopLevel)

public static bool GetIsNativeMenuExported(TopLevel tl)

Parameters

tl TopLevel

Returns

bool

GetMenu(AvaloniaObject)

public static NativeMenu? GetMenu(AvaloniaObject o)

Parameters

o AvaloniaObject

Returns

NativeMenu

SetMenu(AvaloniaObject, NativeMenu?)

public static void SetMenu(AvaloniaObject o, NativeMenu? menu)

Parameters

o AvaloniaObject
menu NativeMenu

Events

Closed

Raised after the menu is closed.

public event EventHandler<EventArgs>? Closed

Event Type

EventHandler<EventArgs>

Remarks

Do not update the menu in this event; use NeedsUpdate.

NeedsUpdate

Raised when the menu requests an update.

public event EventHandler<EventArgs>? NeedsUpdate

Event Type

EventHandler<EventArgs>

Remarks

Use this event to add, remove or modify menu items before a menu is shown or a hotkey is pressed.

Opening

Raised before the menu is opened.

public event EventHandler<EventArgs>? Opening

Event Type

EventHandler<EventArgs>

Remarks

Do not update the menu in this event; use NeedsUpdate.