-api-id | -api-type |
---|---|
M:Microsoft.Windows.AppNotifications.Builder.AppNotificationBuilder.BuildNotification |
winrt method |
Returns an AppNotification object representing the XML payload for an app notification.
An AppNotification object.
Use the methods of the AppNotificationBuilder to assemble the elements you want to include in an app notification. Call BuildNotificaion to get an AppNotification object that you can pass into xref:Microsoft.Windows.AppNotifications.AppNotificationManager.Show(Microsoft.Windows.AppNotifications.AppNotification)?displayProperty=nameWithType.
For guidance on using the AppNotificationBuilder APIs to create the UI for app notifications, see App notification content.
For reference information about the XML schema for app notifications, see App notification content schema.
The following example demonstrates building an AppNotification from an instance of AppNotificationBuilder.
var notification = new AppNotificationBuilder()
.AddText("Notification text.")
.BuildNotification();
AppNotificationManager.Default.Show(notification);