-api-id | -api-type |
---|---|
T:Microsoft.Windows.AppNotifications.Builder.AppNotificationButton |
winrt class |
Represents a button that is displayed on an app notification.
Add a button to the XML payload for an app notification by calling AppNotificationBuilder.AddButton. Up to 5 buttons may be added to a single app notification.
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 adding a button to the XML payload for an app notification.
var notification = new AppNotificationBuilder()
.AddText("Send a message.")
.AddTextBox("textBox")
.AddButton(new AppNotificationButton("Send")
.AddArgument("action", "sendMessage"))
.BuildNotification();
AppNotificationManager.Default.Show(notification);
The resulting XML payload:
<toast>
<visual>
<binding template='ToastGeneric'>
<text>Send a message.</text>
</binding>
</visual>
<actions>
<input id='textBox' type='text'/><action content='Send' arguments='action=sendMessage'/>
</actions>
</toast>