共用方式為


CoreWebView2Notification Class

Definition

An object that represents a HTML Notification object.

public class CoreWebView2Notification
type CoreWebView2Notification = class
Public Class CoreWebView2Notification
Inheritance
CoreWebView2Notification

Properties

BadgeUri

A string containing the URI of the image used to represent the notification when there isn't enough space to display the notification itself.

Body

A string representing the body text of the notification.

BodyImageUri

A string containing the URI of an image to be displayed in the notification.

Direction

The text direction in which to display the notification.

IconUri

A string containing the URI of an icon to be displayed in the notification.

IsSilent

Indicates whether the notification should be silent -- i.e., no sounds or vibrations should be issued, regardless of the device settings.

Language

The notification's language, as intended to be specified using a string representing a language tag (such as en-US) according to BCP47.

RequiresInteraction

A boolean value indicating that a notification should remain active until the user clicks or dismisses it, rather than closing automatically.

ShouldRenotify

Indicates whether the user should be notified after a new notification replaces an old one.

Tag

A string representing an identifying tag for the notification.

Timestamp

Specifies the time at which a notification is created or applicable (past, present, or future).

Title

The title of the notification.

VibrationPattern

Gets the vibration pattern for devices with vibration hardware to emit.

Methods

ReportClicked()

The host may run this to report the notification has been clicked, and it will cause the click event to be raised for non-persistent notifications. You must not run this unless you are handling the NotificationReceived. API throws COMException with error code of HRESULT_FROM_WIN32(ERROR_INVALID_STATE) if Handled is false or ReportShown() has not been run when this is called.

ReportClosed()

The host may run this to report the notification was dismissed, and it will cause the close event to be raised for non-persistent notifications.

ReportShown()

The host may run this to report the notification has been displayed and it will cause the show event to be raised for non-persistent notifications.

Events

CloseRequested

This event is raised when the notification is closed by the web code, such as through notification.close().

Applies to