Freigeben über


AppNotificationButton.SetContextMenuPlacement Methode

Definition

Fordert an, dass die App-Benachrichtigungsschaltfläche im Kontextmenü der Benachrichtigung platziert wird.

public:
 virtual AppNotificationButton ^ SetContextMenuPlacement() = SetContextMenuPlacement;
AppNotificationButton SetContextMenuPlacement();
public AppNotificationButton SetContextMenuPlacement();
function setContextMenuPlacement()
Public Function SetContextMenuPlacement () As AppNotificationButton

Gibt zurück

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

Beispiele

Im folgenden Beispiel wird die Verwendung dieser Methode veranschaulicht, um die Platzierung des Kontextmenüs für die App-Benachrichtigungsschaltfläche festzulegen.

var notification = new AppNotificationBuilder()
    .AddText("Notification text.")
    .AddButton(new AppNotificationButton("Reply")
        .AddArgument("action", "reply")
        .SetContextMenuPlacement())
    .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' placement='contextMenu'/>
    </actions>
</toast>

Hinweise

Sie können auch den Platzierungswert des Kontextmenüs mit der AppNotificationButton.ContextMenuPlacement-eigenschaft festlegen.

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: