Skip to main content

NativeMenuItem Class

Definition

Assembly:Avalonia.Controls
Package:Avalonia
public class NativeMenuItem

Inheritance: object -> AvaloniaObject -> NativeMenuItemBase -> NativeMenuItem

Constructors

NameDescription
NativeMenuItem (2 overloads)No summary available.

NativeMenuItem overloads

NativeMenuItem Constructor

public NativeMenuItem()

NativeMenuItem Constructor

public NativeMenuItem(string header)
Parameters

header string

Methods

NameDescription
Bind (8 overloads)Binds a Avalonia.AvaloniaProperty to an Avalonia.Data.BindingBase. Inherited from AvaloniaObject.
CheckAccessReturns a value indicating whether the current thread is the UI thread. Inherited from AvaloniaObject.
ClearValue (4 overloads)Clears a Avalonia.AvaloniaProperty's local value. Inherited from AvaloniaObject.
CoerceValueCoerces the specified Avalonia.AvaloniaProperty. Inherited from AvaloniaObject.
EqualsCompares two objects using reference equality. Inherited from AvaloniaObject.
GetBaseValueInherited from AvaloniaObject.
GetHashCodeGets the hash code for the object. Inherited from AvaloniaObject.
GetValue (3 overloads)Gets a Avalonia.AvaloniaProperty value. Inherited from AvaloniaObject.
IsAnimatingChecks whether a Avalonia.AvaloniaProperty is animating. Inherited from AvaloniaObject.
IsSetChecks whether a Avalonia.AvaloniaProperty is set on this object. Inherited from AvaloniaObject.
SetCurrentValue (2 overloads)Sets the value of a dependency property without changing its value source. Inherited from AvaloniaObject.
SetValue (3 overloads)Sets a Avalonia.AvaloniaProperty value. Inherited from AvaloniaObject.
VerifyAccessChecks that the current thread is the UI thread and throws if not. Inherited from AvaloniaObject.

Properties

NameDescription
CommandGets or sets the command associated with the menu item.
CommandParameterGets or sets the parameter to pass to the Avalonia.Controls.MenuItem.Command property of a Avalonia.Controls.MenuItem.
GestureGets or sets the input gesture that will be displayed in the menu item.
HasClickHandlersNo summary available.
HeaderGets or sets the content of the control's header.
IconGets or sets the icon that appears in a Avalonia.Controls.MenuItem.
IsCheckedGets or sets if menu item is checked when Avalonia.Controls.MenuItem.ToggleType is Avalonia.Controls.MenuItemToggleType.CheckBox or Avalonia.Controls.MenuItemToggleType.Radio.
IsEnabledGets or sets a value indicating whether the control is enabled for user interaction.
IsVisibleGets or sets a value indicating whether this menu item is visible.
MenuNo summary available.
ToggleTypeGets toggle type of the menu item.
ToolTipGets or sets the tooltip associated with the menu item. This may not be supported by the native menu provider, but will be passed on to the non-native fallback menu item if used.
ParentInherited from NativeMenuItemBase.
DispatcherReturns the Avalonia.AvaloniaObject.Dispatcher that this Avalonia.AvaloniaObject is associated with. Inherited from AvaloniaObject.
ItemInherited from AvaloniaObject.

Command Property

Gets or sets the command associated with the menu item.

public System.Windows.Input.ICommand Command { get; set; }

CommandParameter Property

Gets or sets the parameter to pass to the Avalonia.Controls.MenuItem.Command property of a Avalonia.Controls.MenuItem.

public object CommandParameter { get; set; }

Gesture Property

Gets or sets the input gesture that will be displayed in the menu item.

public Avalonia.Input.KeyGesture Gesture { get; set; }

Remarks

Setting this property does not cause the input gesture to be handled by the menu item, it simply displays the gesture text in the menu.

HasClickHandlers Property

public bool HasClickHandlers { get; set; }

Header Property

Gets or sets the content of the control's header.

public string Header { get; set; }

Icon Property

Gets or sets the icon that appears in a Avalonia.Controls.MenuItem.

public Avalonia.Media.Imaging.Bitmap Icon { get; set; }

IsChecked Property

Gets or sets if menu item is checked when Avalonia.Controls.MenuItem.ToggleType is Avalonia.Controls.MenuItemToggleType.CheckBox or Avalonia.Controls.MenuItemToggleType.Radio.

public bool IsChecked { get; set; }

IsEnabled Property

Gets or sets a value indicating whether the control is enabled for user interaction.

public bool IsEnabled { get; set; }

IsVisible Property

Gets or sets a value indicating whether this menu item is visible.

public bool IsVisible { get; set; }
public Avalonia.Controls.NativeMenu Menu { get; set; }

ToggleType Property

Gets toggle type of the menu item.

public Avalonia.Controls.MenuItemToggleType ToggleType { get; set; }

ToolTip Property

Gets or sets the tooltip associated with the menu item. This may not be supported by the native menu provider, but will be passed on to the non-native fallback menu item if used.

public string ToolTip { get; set; }

Fields

CommandParameterProperty Field

Defines the Avalonia.Controls.MenuItem.CommandParameter property.

public Avalonia.StyledProperty<object> CommandParameterProperty

CommandProperty Field

Defines the Avalonia.Controls.MenuItem.Command property.

public Avalonia.StyledProperty<System.Windows.Input.ICommand> CommandProperty

GestureProperty Field

Defines the Avalonia.Controls.MenuItem.InputGesture property.

public Avalonia.StyledProperty<Avalonia.Input.KeyGesture> GestureProperty

HeaderProperty Field

Defines the Avalonia.Controls.Primitives.HeaderedSelectingItemsControl.Header property.

public Avalonia.StyledProperty<string> HeaderProperty

IconProperty Field

Defines the Avalonia.Controls.MenuItem.Icon property.

public Avalonia.StyledProperty<Avalonia.Media.Imaging.Bitmap> IconProperty

IsCheckedProperty Field

Defines the Avalonia.Controls.MenuItem.IsChecked property.

public Avalonia.StyledProperty<bool> IsCheckedProperty

IsEnabledProperty Field

Defines the Avalonia.Input.InputElement.IsEnabled property.

public Avalonia.StyledProperty<bool> IsEnabledProperty

IsVisibleProperty Field

Defines the Avalonia.Controls.NativeMenuItem.IsVisible property.

public Avalonia.StyledProperty<bool> IsVisibleProperty
public Avalonia.StyledProperty<Avalonia.Controls.NativeMenu> MenuProperty

ToggleTypeProperty Field

Defines the Avalonia.Controls.MenuItem.ToggleType property.

public Avalonia.StyledProperty<Avalonia.Controls.MenuItemToggleType> ToggleTypeProperty

ToolTipProperty Field

Defines the Avalonia.Controls.NativeMenuItem.ToolTip property.

public Avalonia.StyledProperty<string> ToolTipProperty

Events

NameDescription
ClickOccurs when a Avalonia.Controls.NativeMenuItem is clicked.
PropertyChangedRaised when a Avalonia.AvaloniaProperty value changes on this object. Inherited from AvaloniaObject.

Click Event

Occurs when a Avalonia.Controls.NativeMenuItem is clicked.

public event EventHandler Click