CoreWebView2Environment.CreateContextMenuItem Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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.