WinJS.UI.NavBarCommand object

Applies to Windows only

A command to be displayed in a NavBarContainer of a navigation app bar (top app bar).

Explore this functionality in more depth as part of our App features, start to finish series:  Flat navigation, start to finish (HTML) and Hierarchical navigation, start to finish (HTML)

Syntax


<div 
    data-win-control="WinJS.UI.NavBarCommand">
</div>


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

Members

The NavBarCommand object has these types of members:

Constructors

The NavBarCommand object has these constructors.

ConstructorDescription
NavBarCommand

Creates a new NavBarCommand object.

 

Methods

The NavBarCommand object has these methods.

MethodDescription
addEventListener

Registers an event handler for the specified event.

dispatchEvent

Raises an event of the specified type and with additional properties.

dispose

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

removeEventListener

Removes an event handler registered with addEventListener.

 

Properties

The NavBarCommand object has these properties.

PropertyAccess typeDescription

element

Read/write

Gets the DOM element that hosts the NavBarCommand.

icon

Read/write

Gets or sets the NavBarCommand icon.

label

Read/write

Gets or sets the NavBarCommand label.

location

Read/write

Get or sets the page to navigate to when this command is invoked.

splitButton

Read/write

Gets or sets a value that specifies whether the NavBarCommand can contain child commands.

splitOpened

Read-only

Gets a value that indicates whether the splitButton is open.

state

Read/write

Gets or sets a user-defined object that represents the state associated with the command's location.

tooltip

Read/write

Gets or sets the tooltip of the NavBarCommand.

 

Remarks

CSS classes

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

CSS classDescription

win-navbarcommand

Styles the entire NavBarCommand.

win-navbarcommand-button

Styles the button portion of the NavBarCommand.

win-navbarcommand-icon

Styles the NavBarCommand object's icon box.

win-navbarcommand-icononly

Styles entire NavBarCommand when it contains an icon but no label.

win-navbarcommand-label

Styles the label of a NavBarCommand.

win-navbarcommand-labelonly

Styles the entire NavBarCommand when it contains a label but no icon.

win-navbarcommand-splitbutton

Styles the split button of a NavBarCommand.

win-navbarcommand-splitbutton-opened

Styles the split button of a NavBarCommand when the split button is open.

 

Requirements

Minimum supported client

Windows 8.1 [Windows Store apps only]

Minimum supported server

Windows Server 2012 R2 [Windows Store apps only]

Minimum supported phone

None supported

Namespace

WinJS.UI

Library

Ui.js

See also

WinJS.UI Namespace
NavBar
NavBarContainer
BackButton
AppBar
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