AppNotificationBuilder.AddButton(AppNotificationButton) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Adds a button to the app notification.
public:
virtual AppNotificationBuilder ^ AddButton(AppNotificationButton ^ value) = AddButton;
AppNotificationBuilder AddButton(AppNotificationButton const& value);
public AppNotificationBuilder AddButton(AppNotificationButton value);
function addButton(value)
Public Function AddButton (value As AppNotificationButton) As AppNotificationBuilder
Parameters
- value
- AppNotificationButton
An AppNotificationButton object representing the button to be added to the notification.
Returns
Returns the AppNotificationBuilder instance so that additional method calls can be chained.
Examples
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>
Remarks
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.