共用方式為


CoreWebView2ContextMenuRequestedEventArgs.SelectedCommandId Property

Definition

Gets or sets the selected CoreWebView2ContextMenuItem's CommandId.

public int SelectedCommandId { get; set; }
member this.SelectedCommandId : int with get, set
Public Property SelectedCommandId As Integer

Property Value

Remarks

When the app handles the ContextMenuRequested event, it can set this to report the selected command from the context menu. The default value is -1 which means that no selection occurred. The app can also set the command ID for a custom context menu item, which will cause the CustomItemSelected event to be fired, however while command IDs for each custom context menu item is unique during a ContextMenuRequested event, WebView may reassign command ID values of deleted custom ContextMenuItems to new objects and the command ID assigned to the same custom item can be different between each app runtime. The command ID should always be obtained via the CommandId property.

Applies to