Aracılığıyla paylaş


CoreWebView2Controller.AcceleratorKeyPressed Event

Definition

AcceleratorKeyPressed is raised when an accelerator key or key combo is pressed or released while the WebView is focused.

public event EventHandler<Microsoft.Web.WebView2.Core.CoreWebView2AcceleratorKeyPressedEventArgs> AcceleratorKeyPressed;
member this.AcceleratorKeyPressed : EventHandler<Microsoft.Web.WebView2.Core.CoreWebView2AcceleratorKeyPressedEventArgs> 
Public Custom Event AcceleratorKeyPressed As EventHandler(Of CoreWebView2AcceleratorKeyPressedEventArgs) 

Event Type

Remarks

A key is considered an accelerator if either of the following conditions are true:

- Ctrl or Alt is currently being held. - The pressed key does not map to a character.

A few specific keys are never considered accelerators, such as Shift. The Escape key is always considered an accelerator.

Autorepeated key events caused by holding the key down will also raise this event. Filter out the auto-repeated key events by verifying KeyEventLParam or PhysicalKeyStatus.

In windowed mode, this event is synchronous. Until you set Handled to true or the event handler returns, the browser process is blocked and outgoing cross-process COM calls will fail with RPC_E_CANTCALLOUT_ININPUTSYNCCALL. All CoreWebView2 methods work, however.

In windowless mode, the event is asynchronous. Further input do not reach the browser until the event handler returns or Handled is set to true, but the browser process is not blocked, and outgoing COM calls work normally.

It is recommended to set Handled to true as early as you are able to know that you want to handle the accelerator key.

Applies to