Windows Dev Center

PopupMenu.PopupMenu constructor

Creates a new instance of the PopupMenu class.

Syntax


var popupMenu = new Windows.UI.Popups.PopupMenu();

Parameters

This constructor has no parameters.

Remarks

You can see complete code examples that demonstrate how to create and customize context menus in the Context menu sample on the Windows Store app sample home page.

Examples

To customize the context menu, call preventDefault on the oncontextmenu event (e in the example) to suppress the default context menu, and then create a new, empty context menu menu as shown in the Context menu sample.


e.preventDefault(); // Prevent the default context menu.



var menu = new Windows.UI.Popups.PopupMenu();


Use popupMenu.commands to add commands to your context menu.

Requirements (device family)

Device family

Universal

API contract

Windows.Foundation.UniversalApiContract, introduced version 1.0

Namespace

Windows.UI.Popups
Windows::UI::Popups [C++]

Metadata

Windows.Foundation.UniversalApiContract.winmd

Requirements (operating system)

Minimum supported client

Windows 8

Minimum supported server

Windows Server 2012

Minimum supported phone

Windows Phone 8.1 [Windows Runtime apps only]

Namespace

Windows.UI.Popups
Windows::UI::Popups [C++]

Metadata

Windows.winmd

See also

Adding context menus
Context menu sample
Guidelines and checklist for context menus
Reference
PopupMenu
UICommand
UICommandSeparator

 

 

Show:
© 2015 Microsoft