Dela via


PopupMenu Constructor

Definition

Creates a new instance of the PopupMenu class.

In a desktop app, before using an instance of this class in a way that displays UI, you'll need to associate the object with its owner's window handle. For more info, and code examples, see Display WinRT UI objects that depend on CoreWindow.

public:
 PopupMenu();
 PopupMenu();
public PopupMenu();
function PopupMenu()
Public Sub New ()

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 as shown in the Context menu sample.

e.preventDefault(); // Prevent the default context menu.
var menu = new Windows.UI.Popups.PopupMenu();

Remarks

You can see complete code examples that demonstrate how to create and customize context menus in the Context menu sample.

Applies to

See also