Share via


AppNotificationButton.ButtonStyle Property

Definition

Gets or sets the style of a button.

public:
 property AppNotificationButtonStyle ButtonStyle { AppNotificationButtonStyle get(); void set(AppNotificationButtonStyle value); };
AppNotificationButtonStyle ButtonStyle();

void ButtonStyle(AppNotificationButtonStyle value);
public AppNotificationButtonStyle ButtonStyle { get; set; }
var appNotificationButtonStyle = appNotificationButton.buttonStyle;
appNotificationButton.buttonStyle = appNotificationButtonStyle;
Public Property ButtonStyle As AppNotificationButtonStyle

Property Value

A value from the AppNotificationButtonStyle enumeration specifying the style of the button.

Examples

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

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

AppNotificationManager.Default.Show(notification);

The resulting XML payload:

<toast useButtonStyle='true'>
    <visual>
        <binding template='ToastGeneric'>
            <text>Notification text.</text>
        </binding>
    </visual>
    <actions>
        <action content='Reply' arguments='action=reply' hint-buttonStyle='Critical'/>
    </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