WinJS.UI.MenuCommand object
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
- Methods
- Properties
Constructors
The MenuCommand object has these constructors.
Constructor | Description |
---|---|
MenuCommand | Creates a new MenuCommand object. |
Methods
The MenuCommand object has these methods.
Method | Description |
---|---|
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.
Property | Access type | Description |
---|---|---|
Read/write |
Gets or sets a value that indicates whether the MenuCommand is disabled. |
|
Read-only |
Gets the DOM element that hosts the MenuCommand. |
|
Read/write |
Adds an extra CSS class during construction. |
|
Read/write |
Gets or sets the Flyout object displayed by this command. The specified flyout is shown when the MenuCommand's button is invoked. |
|
Read-only |
Gets a value that indicates whether the MenuCommand is hidden or in the process of becoming hidden. |
|
Read-only |
Gets the element identifier (ID) of the command. |
|
Read/write |
Gets or sets the label of the command. |
|
Read/write |
Gets or sets the function to be invoked when the command is clicked. |
|
Read/write |
Gets or sets the selected state of a toggle button. |
|
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 class | Description |
---|---|
win-command |
Styles the entire MenuCommand control. |
Requirements
Minimum WinJS version |
WinJS 1.0 |
Namespace |
WinJS.UI |
See also
Designers
Guidelines for flyouts
Guidelines for context menus