Partager via


CoreWebView2ContextMenuItem Class

Represents a context menu item of a context menu displayed by WebView.

Summary

Members Description
Children Gets the list of children menu items if the kind is CoreWebView2ContextMenuItemKind.Submenu.
CommandId Gets the Command ID for the CoreWebView2ContextMenuItem.
Icon Gets the Icon for the CoreWebView2ContextMenuItem in PNG, Bitmap or SVG formats in the form of an IStream.
IsChecked Gets or sets the checked property of the CoreWebView2ContextMenuItem.
IsEnabled Gets or sets the enabled property of the CoreWebView2ContextMenuItem. Must only be used in the case of a custom context menu item.
Kind Gets the kind of CoreWebView2ContextMenuItem as CoreWebView2ContextMenuItemKind.
Label Gets the localized label for the CoreWebView2ContextMenuItem. Will contain an ampersand for characters to be used as keyboard accelerator.
Name Gets the unlocalized name for the CoreWebView2ContextMenuItem.
ShortcutKeyDescription Gets the localized keyboard shortcut for this CoreWebView2ContextMenuItem.
CustomItemSelected CustomItemSelected event is raised when the user selects this CoreWebView2ContextMenuItem.

Properties

Children

readonly IVector<CoreWebView2ContextMenuItem> Children

Gets the list of children menu items if the kind is CoreWebView2ContextMenuItemKind.Submenu. If the kind is not CoreWebView2ContextMenuItemKind.Submenu, will return null.

CommandId

readonly int CommandId

Gets the Command ID for the CoreWebView2ContextMenuItem. Use this to report the CoreWebView2ContextMenuRequestedEventArgs.SelectedCommandId in CoreWebView2.ContextMenuRequested event.

Icon

readonly IRandomAccessStream Icon

Gets the Icon for the CoreWebView2ContextMenuItem in PNG, Bitmap or SVG formats in the form of an IStream. Stream will be rewound to the start of the image data before being read.

IsChecked

bool IsChecked

Gets or sets the checked property of the CoreWebView2ContextMenuItem. Must only be used for custom context menu items that are of kind CoreWebView2ContextMenuItemKind.CheckBox or CoreWebView2ContextMenuItemKind.Radio.

IsEnabled

bool IsEnabled

Gets or sets the enabled property of the CoreWebView2ContextMenuItem. Must only be used in the case of a custom context menu item. The default value for this is true.

Kind

readonly CoreWebView2ContextMenuItemKind Kind

Gets the kind of CoreWebView2ContextMenuItem as CoreWebView2ContextMenuItemKind.

Label

readonly string Label

Gets the localized label for the CoreWebView2ContextMenuItem. Will contain an ampersand for characters to be used as keyboard accelerator.

Name

readonly string Name

Gets the unlocalized name for the CoreWebView2ContextMenuItem. Use this to distinguish between context menu item types. This will be the English label of the menu item in lower camel case. For example, the "Save as" menu item will be "saveAs". Extension menu items will be "extension", custom menu items will be "custom" and spellcheck items will be "spellCheck". Some example context menu item names are:

  • "saveAs"
  • "copyImage"
  • "openLinkInNewWindow"

ShortcutKeyDescription

readonly string ShortcutKeyDescription

Gets the localized keyboard shortcut for this CoreWebView2ContextMenuItem. It will be the empty string if there is no keyboard shortcut. This is text intended to be displayed to the end user to show the keyboard shortcut. For example this property is Ctrl+Shift+I for the "Inspect" CoreWebView2ContextMenuItem.

Events

CustomItemSelected

CustomItemSelected event is raised when the user selects this CoreWebView2ContextMenuItem. Will only be raised for end developer created context menu items.

Type: TypedEventHandler<CoreWebView2ContextMenuItem, Object>

Referenced by