Share via


WinJS.UI.Command object

Represents a command.

Syntax

<div 
  data-win-control="WinJS.UI.Command">
</div>
var object = new WinJS.UI.Command();

Members

The Command object has these types of members:

  • Constructors
  • Events
  • Methods
  • Properties

Constructors

The Command object has these constructors.

Constructor Description
Command

Creates a new Command object.

 

Events

The Command object has these events.

Event Description
onclick

Raised when the user clicks the Command.

oncommandvisibilitychanged

Raised when the value of the Command object's hidden property changes.

 

Methods

The Command object has these methods.

Method Description
addEventListener

Registers an event handler for the specified event.

dispose

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

removeEventListener

Removes an event handler registered with addEventListener.

 

Properties

The Command object has these properties.

Property Access type Description

disabled

Read/write

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

element

Read-only

Gets the DOM element that hosts the Command.

extraClass

Read/write

Gets or sets additional CSS classes to apply to the element that hosts the Command.

firstElementFocus

Read/write

Gets or sets keyboard navigation behavior in the app bar for Command elements of type "content". This property identifies the element that receives focus within the Command host <div> (or container) when navigating from the left.

flyout

Read/write

Gets or sets a Flyout object that is displayed when the Command is invoked.

hidden

Read-only

Gets a value that indicates whether the Command is hidden.

icon

Read/write

Gets or sets the Command icon.

id

Read-only

Gets or sets the Command identifier.

label

Read/write

Gets or sets the Command label.

lastElementFocus

Read/write

Gets or sets keyboard navigation behavior in the app bar for Command elements of type "content". This property identifies the element that receives focus within the Command host <div> (or container) when navigating from the right.

priority

Read/write

Gets or sets the priority of the Command.

section

Read/write

Gets or sets the area of the AppBar or ToolBar that hosts this Command.

selected

Read/write

Gets or sets the selected state of an Command of type "toggle".

tooltip

Read/write

Gets or sets the tooltip displayed for the Command.

type

Read/write

Gets or sets the type of the command.

 

Requirements

Minimum WinJS version

WinJS 4.0

Namespace

WinJS.UI