Share via


AppNotificationButton Konstruktoren

Definition

Überlädt

AppNotificationButton()

Initialisiert eine neue instance der AppNotificationButton-Klasse.

AppNotificationButton(String)

Initialisiert eine neue instance der AppNotificationButton-Klasse mit dem angegebenen Schaltflächentext.

AppNotificationButton()

Initialisiert eine neue instance der AppNotificationButton-Klasse.

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

Beispiele

Das folgende Beispiel zeigt die Verwendung dieser Methode zum Hinzufügen einer Schaltfläche zu einer App-Benachrichtigung.

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

AppNotificationManager.Default.Show(notification);

Die resultierende XML-Nutzlast:

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

Hinweise

Fügen Sie der XML-Nutzlast für eine App-Benachrichtigung ein AppNotificationButton-Element hinzu, indem Sie AppNotificationBuilder.AddButton aufrufen.

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

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

Gilt für:

AppNotificationButton(String)

Initialisiert eine neue instance der AppNotificationButton-Klasse mit dem angegebenen Schaltflächentext.

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

Parameter

content
String

Platform::String

winrt::hstring

Der auf der Schaltfläche angezeigte Text.

Beispiele

Das folgende Beispiel zeigt die Verwendung dieser Methode zum Hinzufügen einer Schaltfläche zu einer App-Benachrichtigung.

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

AppNotificationManager.Default.Show(notification);

Die resultierende XML-Nutzlast:

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

Hinweise

Fügen Sie der XML-Nutzlast für eine App-Benachrichtigung ein AppNotificationButton-Element hinzu, indem Sie AppNotificationBuilder.AddButton aufrufen.

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

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

Gilt für: