Share via


AppNotificationButton.ContextMenuPlacement Property

Definition

Gets or sets a value specifying whether the button is displayed inside the app notification context menu.

public:
 property bool ContextMenuPlacement { bool get(); void set(bool value); };
bool ContextMenuPlacement();

void ContextMenuPlacement(bool value);
public bool ContextMenuPlacement { get; set; }
var boolean = appNotificationButton.contextMenuPlacement;
appNotificationButton.contextMenuPlacement = boolean;
Public Property ContextMenuPlacement As Boolean

Property Value

Boolean

bool

True if the button is placed inside the app notification context menu; otherwise, false.

Examples

The following example shows the usage of this method to add the button to the app notification context menu.

var button = new AppNotificationButton("More info")
    .AddArgument("action", "info");
button.ContextMenuPlacement = true;

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

AppNotificationManager.Default.Show(notification);

The resulting XML payload:

<toast>
    <visual>
        <binding template='ToastGeneric'>
            <text>Notification text.</text>
        </binding>
    </visual>
    <actions>
        <action content='More info' arguments='action=info' placement='contextMenu'/>
    </actions>
</toast>

Remarks

You can also set the context menu placement value by calling AppNotificationButton.SetContextMenuPlacement.

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