AppNotificationBuilder.AddButton(AppNotificationButton) メソッド

定義

アプリ通知にボタンを追加します。

public:
 virtual AppNotificationBuilder ^ AddButton(AppNotificationButton ^ value) = AddButton;
AppNotificationBuilder AddButton(AppNotificationButton const& value);
public AppNotificationBuilder AddButton(AppNotificationButton value);
function addButton(value)
Public Function AddButton (value As AppNotificationButton) As AppNotificationBuilder

パラメーター

value
AppNotificationButton

通知に追加するボタンを表す AppNotificationButton オブジェクト。

戻り値

追加のメソッド呼び出しをチェーンできるように 、AppNotificationBuilder インスタンスを返します。

次の例では、アプリ通知の XML ペイロードにボタンを追加する方法を示します。

var notification = new AppNotificationBuilder()
    .AddText("Send a message.")
    .AddTextBox("textBox")
    .AddButton(new AppNotificationButton("Send")
        .AddArgument("action", "sendMessage"))
    .BuildNotification();

AppNotificationManager.Default.Show(notification);

結果の XML ペイロード:

<toast>
    <visual>
        <binding template='ToastGeneric'>
            <text>Send a message.</text>
        </binding>
    </visual>
    <actions>
        <input id='textBox' type='text'/><action content='Send' arguments='action=sendMessage'/>
    </actions>
</toast>

注釈

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

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

適用対象