In This Article

MenuFactoryMenuItemOptions Class

The options to be used when creating a menu item using IMenuFactory.

public class MenuFactoryMenuItemOptions
Inheritance:
object object

Constructors

MenuFactoryMenuItemOptions()

Initializes an instance of the class.

public MenuFactoryMenuItemOptions()

Properties

AllowAccessKey

Indicates if Text allows access key.

public bool AllowAccessKey { get; set; }

Property Value

bool:

true to allow access keys; otherwise, false to escape the underscores characters that identify access keys. The default value is true.

AllowPopup

Indicates that the menu item created should allow for the configuration of a popup of additional menu items.

public bool AllowPopup { get; set; }

Property Value

bool:

This property is ignored for menu items that do not require a special Type to support popups. The default value is false.

Command

The ICommand to assign to the menu item.

public ICommand? Command { get; set; }

Property Value

ICommand

CommandParameter

The command parameter.

public object? CommandParameter { get; set; }

Property Value

object

Description

A description of the menu item which could be used for tooltips.

public string? Description { get; set; }

Property Value

string

Icon

The object which defines the menu icon.

public object? Icon { get; set; }

Property Value

object

IconTemplate

The Avalonia.Controls.Templates.IDataTemplate that may be necessary to display the Icon.

public IDataTemplate? IconTemplate { get; set; }

Property Value

IDataTemplate

InputGesture

The input gesture associated with the menu item.

public KeyGesture? InputGesture { get; set; }

Property Value

KeyGesture

IsChecked

Whether the menu item is checked.

public bool? IsChecked { get; set; }

Property Value

bool?:

Since menu items do not support tri-state, a null value indicates the menu item cannot be checked.

IsEnabled

Whether the menu item is enabled.

public bool? IsEnabled { get; set; }

Property Value

bool?:

true to enable the item, false to disable the menu item, or null to use default logic (e.g., let the Command dictate enabled state).

Key

The key that uniquely identifies the menu item.

public string? Key { get; set; }

Property Value

string

Owner

An owner for the menu item which can be used for additional context.

public object? Owner { get; set; }

Property Value

object

Tag

An object that contains data about the menu item to be created.

public object? Tag { get; set; }

Property Value

object

Text

The text to be displayed.

public string? Text { get; set; }

Property Value

string

ToggleType

The toggle type to be used for checkable menu items.

public MenuItemToggleType ToggleType { get; set; }

Property Value

MenuItemToggleType:

This property is ignored when IsChecked is null. The default value is Avalonia.Controls.MenuItemToggleType.CheckBox.

Inherited Members

Extension Methods