AppNotificationButton.Icon プロパティ

定義

AppNotificationButton のアイコンを取得または設定します。

public:
 property Uri ^ Icon { Uri ^ get(); void set(Uri ^ value); };
Uri Icon();

void Icon(Uri value);
public System.Uri Icon { get; set; }
var uri = appNotificationButton.icon;
appNotificationButton.icon = uri;
Public Property Icon As Uri

プロパティ値

ボタン アイコンの URI。

次の例は、このプロパティを使用してアプリ通知ボタンのアイコンを設定する方法を示しています。

var button = new AppNotificationButton("Reply")
    .AddArgument("action", "reply");
button.Icon = new Uri("ms-appx:///Images/Reply.png");

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='Reply' arguments='action=reply' imageUri='ms-appx:///Images/Reply.png'/>
    </actions>
</toast>

注釈

AppNotificationButton.SetIcon を呼び出して、アプリ通知ボタンのアイコンを設定することもできます。

次のスクリーンショットは、アイコンを使用するアプリ通知ボタンを示しています。

アイコンを使用するボタンを含むアプリ通知のスクリーンショット。

サポートされているイメージ ファイルの種類は次のとおりです。

  • .png
  • .jpg
  • 。Svg

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

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

適用対象