EN
Ce contenu n’est pas disponible dans votre langue. Voici la version anglaise.

WinJS.UI.MenuCommand object

Applies to Windows only

A command to be displayed in a Menu object.

Syntax


<button data-win-control="WinJS.UI.MenuCommand" />


var object = new WinJS.UI.MenuCommand();

Members

The MenuCommand object has these types of members:

Constructors

The MenuCommand object has these constructors.

ConstructorDescription
MenuCommand

Creates a new MenuCommand object.

 

Methods

The MenuCommand object has these methods.

MethodDescription
addEventListener

Registers an event handler for the specified event.

dispose

Releases resources held by this MenuCommand. Call this method when the MenuCommand is no longer needed. After calling this method, the MenuCommand becomes unusable.

removeEventListener

Removes an event handler that the addEventListener method registered.

 

Properties

The MenuCommand object has these properties.

PropertyAccess typeDescription

disabled

Read/write

Gets or sets a value that indicates whether the MenuCommand is disabled.

element

Read-only

Gets the DOM element that hosts the MenuCommand.

extraClass

Read/write

Adds an extra CSS class during construction.

flyout

Read/write

Gets or sets the Flyout object displayed by this command. The specified flyout is shown when the MenuCommand's button is invoked.

hidden

Read-only

Gets a value that indicates whether the MenuCommand is hidden or in the process of becoming hidden.

id

Read-only

Gets the element identifier (ID) of the command.

label

Read/write

Gets or sets the label of the command.

onclick

Read/write

Gets or sets the function to be invoked when the command is clicked.

selected

Read/write

Gets or sets the selected state of a toggle button.

type

Read-only

Gets the type of the command.

 

Remarks

Styling the MenuCommand

CSS classes

To customize a MenuCommand, you can define your own styles for these CSS classes (defined by the Windows Library for JavaScript style sheets):

CSS classDescription

win-command

Styles the entire MenuCommand control.

 

Requirements

Minimum supported client

Windows 8 [Windows Store apps only]

Minimum supported server

Windows Server 2012 [Windows Store apps only]

Minimum supported phone

None supported

Namespace

WinJS.UI

Library

Ui.js

See also

WinJS.UI Namespace
Menu
Flyout
Displaying popups
Laying out your UI
HTML flyout control sample
Designers
Command patterns
Flyout
Guidelines for flyouts
Context menu
Guidelines for context menus

 

 

Afficher:
© 2014 Microsoft