Class NavBarContainer

Contains a group of NavBarCommand objects in a NavBar.

Index

Constructor methods

Properties

Methods

Constructor methods

constructor(element?: HTMLElement, options?: any): NavBarContainer

Creates a new NavBarContainer.

constructor

Parameters

  • element?: HTMLElement optional

    The DOM element hosts the new NavBarContainer.

  • options?: any optional

    An object that contains one or more property/value pairs to apply to the new control. Each property of the options object corresponds to one of the control's properties or events.

Returns

NavBarContainer

Properties

public currentIndex: number

Gets or sets the index of the current item.

public data: List

Gets or sets a WinJS.Binding.List that generates NavBarCommand objects.

public element: HTMLElement

Gets the HTML element that hosts this NavBarContainer.

public fixedSize: boolean

Gets or sets a value that specifies whether NavBarCommand objects in this container use a fixed or dynamic width.

public layout: Orientation

Gets or sets a value that specifies whether the NavBarContainer has a horizontal or vertical layout.

public maxRows: number

Gets or sets a value that specifies how many rows of navigation commands to display on a page.

public template: Template

Gets or sets the WinJS.Binding.Template or templating function that creates the DOM elements for each item in the data source. Each item can contain multiple elements, but it must have a single root element.

Methods

public addEventListener(eventName: string, eventHandler: Function, useCapture?: boolean)

Registers an event handler for the specified event.

Parameters

  • eventName: string

    The name of the event to handle. Note that you drop the "on" when specifying the event name. For example, instead of specifying "onclick", you specify "click".

  • eventHandler: Function

    The event handler function to associate with the event.

  • useCapture?: boolean optional

    Set to true to register the event handler for the capturing phase; otherwise, set to false to register the event handler for the bubbling phase.

public dispatchEvent(type: string, eventProperties: any): boolean

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

Parameters

  • type: string

    The type (name) of the event.

  • eventProperties: any

    The set of additional properties to be attached to the event object when the event is raised.

Returns

boolean

true if preventDefault was called on the event, otherwise false.

public 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.

public forceLayout()

Forces the NavBarContainer to update its layout. Use this function when making the NavBarContainer visible again after you set its style.display property to "none".

public oninvoked(eventInfo: CustomEvent)

Occurs when a child NavBarCommand object's click event fires.

Parameters

  • eventInfo: CustomEvent

    An object that contains information about the event. The detail property of this object contains the following sub-properties: detail.index, detail.navbarcommand, detail.data.

public onsplittoggle(eventInfo: CustomEvent)

Occurs when the split button of a child NavBarCommand is opened or closed. A split button is toggled when the user navigates to another page or opens another split button.

Parameters

  • eventInfo: CustomEvent

    An object that contains information about the event. The detail property of this object contains the following sub-properties: detail.opened, detail.index, detail.navbarcommand, detail.data.

public removeEventListener(eventName: string, eventCallback: Function, useCapture?: boolean)

Removes an event handler that the addEventListener method registered.

Parameters

  • eventName: string

    The name of the event that the event handler is registered for.

  • eventCallback: Function

    The event handler function to remove.

  • useCapture?: boolean optional

    Set to true to remove the capturing phase event handler; set to false to remove the bubbling phase event handler.