Note

Access to this page requires authorization. You can try signing in or .

Access to this page requires authorization. You can try .

AppNotificationButton.SetButtonStyle(AppNotificationButtonStyle) 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.

Sets the button style for the app notification button.

public:
 virtual AppNotificationButton ^ SetButtonStyle(AppNotificationButtonStyle value) = SetButtonStyle;
AppNotificationButton SetButtonStyle(AppNotificationButtonStyle const& value);
public AppNotificationButton SetButtonStyle(AppNotificationButtonStyle value);
function setButtonStyle(value)
Public Function SetButtonStyle (value As AppNotificationButtonStyle) As AppNotificationButton

Parameters

value
AppNotificationButtonStyle

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

Returns

Returns the AppNotificationButton instance so that additional method calls can be chained.

Examples

The following example demonstrates checking to see if the app notification button styles are supported and if so, setting the button style.

var button = new AppNotificationButton("Reply")
 .AddArgument("action", "reply");

if(AppNotificationButton.IsButtonStyleSupported())
{
 button.SetButtonStyle(AppNotificationButtonStyle.Critical);
}

var notification = new AppNotificationBuilder()
 .AddText("Notification text.")
 .AddButton(button)
 .BuildNotification();

AppNotificationManager.Default.Show(notification);

The resulting XML payload if the urgent scenario is supported:

<toast>
 <visual>
 <binding template='ToastGeneric'>
 <text>Notification text.</text>
 </binding>
 </visual>
 <actions>
 <action content='Reply' arguments='action=reply' hint-toolTip='Click to reply.'/>
 </actions>
</toast>

Remarks

Button styles are only supported for on Windows 10 Build 19041 and later. Call AppNotificationButton.IsButtonStyleSupported to determine at runtime if button styles are supported on the current device.

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


Feedback

Was this page helpful?