CoreWebView2NotificationReceivedEventArgs Class

Event args for the CoreWebView2.NotificationReceived.

Summary

Members Description
Handled Sets whether the CoreWebView2.NotificationReceived is handled by the host after the event handler completes or if there is a deferral then after the deferral is completed.
Notification The notification that was received.
SenderOrigin The origin of the web content that sends the notification, such as https://example.com/ or https://www.example.com/.
GetDeferral Gets a Deferral object.

Properties

Handled

bool Handled

Sets whether the CoreWebView2.NotificationReceived is handled by the host after the event handler completes or if there is a deferral then after the deferral is completed. If CoreWebView2NotificationReceivedEventArgs.Handled is set to true then WebView will not display the notification with the default UI, and the host will be responsible for handling the notification and for letting the web content know that the notification has been displayed, clicked, or closed. You must set CoreWebView2NotificationReceivedEventArgs.Handled to true before you call CoreWebView2Notification.ReportShown, and CoreWebView2Notification.ReportClosed, otherwise they will fail with HRESULT_FROM_WIN32(ERROR_INVALID_STATE). If after the event handler or deferral completes CoreWebView2NotificationReceivedEventArgs.Handled is set to false then WebView will display the default notification UI. Note that you cannot un-handle this event once you have set CoreWebView2NotificationReceivedEventArgs.Handled to be true. The initial value is false.

Notification

readonly CoreWebView2Notification Notification

The notification that was received. You can access the properties on the Notification object to show your own notification.

SenderOrigin

readonly string SenderOrigin

The origin of the web content that sends the notification, such as https://example.com/ or https://www.example.com/.

Methods

GetDeferral

Deferral GetDeferral()

Gets a Deferral object. Use this to Complete the event at a later time.

Referenced by