AppNotificationButton.SetButtonStyle(AppNotificationButtonStyle) Methode

Definition

Legt den Schaltflächenstil für die App-Benachrichtigungsschaltfläche fest.

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

Parameter

value
AppNotificationButtonStyle

Ein Wert aus der AppNotificationButtonStyle-Aufzählung , der die Formatvorlage für die Schaltfläche angibt.

Gibt zurück

Gibt die AppNotificationButton-Instanz zurück, sodass zusätzliche Methodenaufrufe verkettet werden können.

Beispiele

Im folgenden Beispiel wird die Überprüfung veranschaulicht, ob die Stile der App-Benachrichtigungsschaltfläche unterstützt werden und wenn ja, das Festlegen des Schaltflächenstils.

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

Die resultierende XML-Nutzlast, wenn das dringende Szenario unterstützt wird:

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

Hinweise

Schaltflächenformatvorlagen werden nur für Windows 10 Build 19041 und höher unterstützt. Rufen Sie "AppNotificationButton.IsButtonStyleSupported " auf, um zur Laufzeit zu ermitteln, ob Schaltflächenformatvorlagen auf dem aktuellen Gerät unterstützt werden.

Anleitungen zur Verwendung der AppNotificationBuilder--APIs zum Erstellen der Benutzeroberfläche für App-Benachrichtigungen finden Sie unter App-Benachrichtigungsinhalt.

Referenzinformationen zum XML-Schema für App-Benachrichtigungen finden Sie unter App-Benachrichtigungsinhaltsschema.

Gilt für: