Share via


AppNotificationButton.Content Property

Definition

Gets or sets the button text for an AppNotificationButton.

public:
 property Platform::String ^ Content { Platform::String ^ get(); void set(Platform::String ^ value); };
winrt::hstring Content();

void Content(winrt::hstring value);
public string Content { get; set; }
var string = appNotificationButton.content;
appNotificationButton.content = string;
Public Property Content As String

Property Value

String

Platform::String

winrt::hstring

A string containing the button text.

Examples

The following example shows the usage of this property to set the button text for an app notification button.

var args = new Dictionary<string, string>() { { "action", "reply" }, { "arg2", "value" } };
var button = new AppNotificationButton();
button.Content = "Reply";
button.Arguments = args;

var notification = new AppNotificationBuilder()
    .AddText("Notification text.")
    .AddButton(button)
    .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;arg2=value'/>
    </actions>
</toast>

Remarks

For guidance on using the AppNotificationBuilder APIs to create the UI forapp notifications, see App notification content.

For reference information about the XML schema for app notifications, see App notification content schema.

Applies to