Share via


Adding context menus (HTML)

[ This article is for Windows 8.x and Windows Phone 8.x developers writing Windows Runtime apps. If you’re developing for Windows 10, see the latest documentation ]

Purpose

The context menu is a lightweight menu that gives users immediate access to actions (like clipboard commands) on text or UI objects in Windows Store apps. The system provides apps with default context menus for text, so you won't need to do any extra work to incorporate context menus into your apps. As long as you make the text in your apps selectable or editable, you get the text context menu for free. The default context menu shows the clipboard commands (Cut, Copy, and Paste).

Default context menu
The default context menu for text, which shows the Cut, Copy, and Paste clipboard commands. If there's no text in the clipboard that can be pasted into text that the user can edit, the default context menu doesn't show the Paste command.

 

You can replace the default context menus with menus that show custom commands for text. You can also create your own context menus that act on other UI objects (like thumbnails). However, the number of commands you show in a context menu should be minimal. Use context menus only to show commands that are directly relevant to users and that cannot be readily accessed through the app toolbar or direct manipulation (like touch rotation).

Context menus can show a maximum of six commands. This limit helps to ensure that the context menu remains uncluttered, usable, and directly relevant to users.

For more info on how to customize your own context menu, see Context menu sample.

Context menu sample