Skip to content

Latest commit

 

History

History
57 lines (39 loc) · 1.71 KB

File metadata and controls

57 lines (39 loc) · 1.71 KB
-api-id -api-type
T:Microsoft.Windows.AppNotifications.Builder.AppNotificationButton
winrt class

Microsoft.Windows.AppNotifications.Builder.AppNotificationButton

-description

Represents a button that is displayed on an app notification.

-remarks

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.

-see-also

-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>