AppNotificationButton.Icon Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets or sets the icon for an 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
Property Value
The URI of the button icon.
Examples
The following example shows the usage of this property to set the icon for an app notification button.
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);
The resulting XML payload:
<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>
Remarks
You can also set the icon for an app notification button by calling AppNotificationButton.SetIcon).
The following screenshot illustrates an app notification button that uses an icon.
Supported image file types include:
- .png
- .jpg
- .svg
For guidance on using the AppNotificationBuilder APIs to create the UI for app notifications, see App notification content.
For reference information about the XML schema for app notifications, see App notification content schema.