AppNotificationButton.ContextMenuPlacement プロパティ

定義

アプリ通知コンテキスト メニュー内にボタンを表示するかどうかを指定する値を取得または設定します。

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

プロパティ値

Boolean

bool

True を指定すると、アプリ通知コンテキスト メニュー内にボタンが配置されます。それ以外の場合は false。

次の例は、このメソッドを使用して、アプリ通知コンテキスト メニューにボタンを追加する方法を示しています。

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

結果の XML ペイロード:

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

注釈

AppNotificationButton.SetContextMenuPlacement を呼び出して、コンテキスト メニューの配置値を設定することもできます。

AppNotificationBuilder API を使用してアプリ通知用 UI を作成する方法のガイダンスについては、「アプリ通知のコンテンツ」を参照してください。

アプリ通知の XML スキーマのリファレンス情報については、「アプリ通知 コンテンツ スキーマ」を参照してください。

適用対象