Menu object
TOC
Réduire la table des matières
Développer la table des matières

WinJS.UI.Menu object

[This documentation is preliminary and is subject to change.]

Applies to: Metro style apps only

Represents a menu flyout for displaying commands.

Syntax


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


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

Members

The Menu object has these types of members:

Events

The Menu object has these events.

EventDescription
afterhide

Occurs immediately after the Menu is hidden.

aftershow

Occurs after the Menu is shown.

beforehide

Occurs before the Menu is hidden

beforeshow

Occurs before a hidden Menu is shown.

 

Methods

The Menu object has these methods.

MethodDescription
addEventListener

Registers an event handler for the specified event.

getCommandById

Returns the MenuCommand object identified by id.

hide

Hides the Menu.

hideCommands

Hides the specified commands of the Menu.

Menu

Creates a new Menu object.

removeEventListener

Removes an event handler that the addEventListener method registered.

show

Shows the Menu, if hidden, regardless of other states.

showCommands

Shows the specified commands of the Menu.

showOnlyCommands

Shows the specified commands of the Menu while hiding all other commands.

 

Properties

The Menu object has these properties.

PropertyDescription

alignment

Gets or sets the default alignment to be used for this Menu.

anchor

Gets or sets the default anchor to be used for this Menu.

commands

Sets the MenuCommand objects that appear in the menu

element

Gets the DOM element that hosts the Menu.

hidden

Gets a value that indicates whether the Menu is hidden or in the process of becoming hidden.

placement

Gets or sets the default placement to be used for this Menu.

 

Remarks

Styling the Menu

CSS classes

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

CSS classDescription

win-command

Styles the commands in the Menu.

win-menu

Styles the entire Menu control.

 

Note  There are several CSS classes that are shared between multiple Windows Library for JavaScript controls. To limit your custom styles to a specific control, assign the control an ID or custom class name and use that as part of your style selector.

Requirements

Namespace

WinJS.UI

Library

 

 

Build date: 2/10/2012

Ajouts de la communauté

AJOUTER
Afficher:
© 2016 Microsoft