Xamarin.Forms Guides | Samples

Xamarin.Forms.MenuItem Class

Class that presents a menu item and associates it with a command.

See Also: MenuItem

Syntax

public class MenuItem : BaseMenuItem, IMenuItemController

Remarks

XAML for Xamarin.Forms supports the following properties for the MenuItem class:

PropertyValue
Command

A binding to a command.

CommandParameter

A parameter to pass to the command.

IsDestructive

true or false, to indicate whether the command deletes an item in a list.

Text

The text to display on the menu item.

Requirements

Namespace: Xamarin.Forms
Assembly: Xamarin.Forms.Core (in Xamarin.Forms.Core.dll)
Assembly Versions: 1.3.0.0, 1.4.0.0, 1.5.0.0, 2.0.0.0

The members of Xamarin.Forms.MenuItem are listed below.

See Also: BaseMenuItem

Public Constructors

Intitializes a new MenuItem instance.

Public Fields

static readonly
CommandParameterPropertyBindableProperty. Identifies the command parameter bound property.
static readonly
CommandPropertyBindableProperty. Identifies the command bound property.
static readonly
IconPropertyBindableProperty. Identfies the icon bound property.
static readonly
IsDestructivePropertyBindableProperty. Identifies the IsDestructive bound property.
static readonly
TextPropertyBindableProperty. Identifies the text bound property.

Public Properties

CommandICommand. Gets or sets the command that is run when the menu is clicked.
CommandParameterObject. Gets or sets the parameter that is passed to the command.
IconFileImageSource. Gets or sets the icon for the menu item.
IsDestructiveBoolean. Gets or sets a value that indicates whether or not the menu item removes its associated UI element.
TextString. The text of the menu item.

Protected Methods

OnClicked()
When overriden by an app dev, implements behavior when the menu item is clicked.

Public Events

ClickedEvent that is raised when the menu item is clicked.

Explicitly Implemented Interface Members

MenuItem$IMenuItemController.ActivateThis method is for internal use by platform renderers.
[read-only]
MenuItem$IMenuItemController.IsEnabledBoolean. Internal.
[read-only]
MenuItem$IMenuItemController.IsEnabledPropertyNameString. Internal.