Compartir a través de


CoreWebView2Environment.CreateContextMenuItem Method

Definition

Create a custom CoreWebView2ContextMenuItem object to insert into the WebView context menu.

public Microsoft.Web.WebView2.Core.CoreWebView2ContextMenuItem CreateContextMenuItem (string Label, System.IO.Stream iconStream, Microsoft.Web.WebView2.Core.CoreWebView2ContextMenuItemKind Kind);
member this.CreateContextMenuItem : string * System.IO.Stream * Microsoft.Web.WebView2.Core.CoreWebView2ContextMenuItemKind -> Microsoft.Web.WebView2.Core.CoreWebView2ContextMenuItem
Public Function CreateContextMenuItem (Label As String, iconStream As Stream, Kind As CoreWebView2ContextMenuItemKind) As CoreWebView2ContextMenuItem

Parameters

Label
String
iconStream
Stream

Returns

Remarks

CoreWebView2 will rewind the icon stream before decoding. There is a limit of 1000 active custom context menu items at a given time per CoreWebView2Environment. Attempting to create more before deleting existing ones will fail with ERROR_NOT_ENOUGH_QUOTA. It is recommended to reuse custom ContextMenuItems across CoreWebView2ContextMenuRequested events for performance. The created object's IsEnabled property will default to true and IsChecked property will default to false. A CommandId will be assigned that's unique across active custom context menu items, but command ID values of deleted custom ContextMenuItems can be reassigned.

Applies to