AppBarCommand.type property

Applies to Windows and Windows Phone

Gets the type of the command.

Syntax


var type = appBarCommand.type;

Property value

Type: string

The command can be one of the following types:

  • "button"

    This is the default value for the type. It defines a standard button and can only be applied to a <button> element.

  • "toggle"

    This creates a button that can be selected or de-selected. When the button is selected, the colors of the icon of the AppBarCommand are reversed (black to white and white to black, for example). Only a <button> element can host a toggle AppBarCommand.

  • "flyout"

    This creates a button that reveals an HTML fragment adjacent to it (a flyout). To create a flyout AppBarCommand, you need to specify both the type as "flyout" and set its flyout property. The flyout property must reference a defined Flyout control. Only a <button> element can host a flyout AppBarCommand.

  • "separator"

    This creates a horizontal line in the AppBar, to create a visual separation between other AppBarCommand controls. Only a <hr/> element can host a separator AppBarCommand.

  • "content"

    This creates an AppBarCommand that can host other HTML markup inside of it, including text, <input> tags, and even a subset of WinJS controls. Only a <div> element can host a content AppBarCommand.

  • Applies to Windows Phone

Note  

The command can be one of these types:

  • "button"
  • "toggle"

Remarks

For an app bar toggle command to work with accessibility tools like Narrator, you must attach an onPropertyChange event handler by using the attachEvent method. You must use the detachEvent method to remove the event handler.

Requirements

Minimum supported client

Windows 8 [Windows Store apps only]

Minimum supported server

Windows Server 2012 [Windows Store apps only]

Minimum supported phone

Windows Phone 8.1

Namespace

WinJS.UI

Library

Ui.js

See also

AppBarCommand
AppBar
AppBarIcon
BackButton
NavBar
Your first app - Part 3: PageControl objects and navigation
Navigating between pages (HTML)
Adding app bars
Adding nav bars
HTML AppBar control sample
HTML NavBar control sample
Navigation and navigation history sample
Designers
Command patterns
Navigation patterns
Guidelines for app bars
Bottom app bar
Top app bar

 

 

Show:
© 2014 Microsoft