Share via


AppNotificationButton Constructors

Definition

Overloads

AppNotificationButton()

Initializes a new instance of the AppNotificationButton class.

AppNotificationButton(String)

Initializes a new instance of the AppNotificationButton class with the specified button text.

AppNotificationButton()

Initializes a new instance of the AppNotificationButton class.

public:
 AppNotificationButton();
 AppNotificationButton();
public AppNotificationButton();
function AppNotificationButton()
Public Sub New ()

Examples

The following example shows the usage of this method to add a button to an app notification.

var notification = new AppNotificationBuilder()
    .AddText("Notification text.")
    .AddButton(new AppNotificationButton()
        .AddArgument("action", "reply"))
    .BuildNotification();

AppNotificationManager.Default.Show(notification);

The resulting XML payload:

<toast>
    <visual>
        <binding template='ToastGeneric'>
            <text>Notification text.</text>
        </binding>
    </visual>
    <actions>
        <action content='' arguments='action=reply'/>
    </actions>
</toast>

Remarks

Add an AppNotificationButton to the xml payload for an app notification by calling AppNotificationBuilder.AddButton.

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.

Applies to

AppNotificationButton(String)

Initializes a new instance of the AppNotificationButton class with the specified button text.

public:
 AppNotificationButton(Platform::String ^ content);
 AppNotificationButton(winrt::hstring const& content);
public AppNotificationButton(string content);
function AppNotificationButton(content)
Public Sub New (content As String)

Parameters

content
String

Platform::String

winrt::hstring

The text displayed on the button.

Examples

The following example shows the usage of this method to add a button to an app notification.

var notification = new AppNotificationBuilder()
    .AddText("Notification text.")
    .AddButton(new AppNotificationButton("Reply")
        .AddArgument("action", "reply"))
    .BuildNotification();

AppNotificationManager.Default.Show(notification);

The resulting XML payload:

<toast>
    <visual>
        <binding template='ToastGeneric'>
            <text>Notification text.</text>
        </binding>
    </visual>
    <actions>
        <action content='Reply' arguments='action=reply'/>
    </actions>
</toast>

Remarks

Add an AppNotificationButton to the xml payload for an app notification by calling AppNotificationBuilder.AddButton.

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.

Applies to