AppNotificationButton.SetIcon(Uri) Method
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.
Sets the icon for an AppNotificationButton.
public:
virtual AppNotificationButton ^ SetIcon(Uri ^ value) = SetIcon;
AppNotificationButton SetIcon(Uri const& value);
public AppNotificationButton SetIcon(System.Uri value);
function setIcon(value)
Public Function SetIcon (value As Uri) As AppNotificationButton
Parameters
Returns
Returns the AppNotificationButton instance so that additional method calls can be chained.
Examples
The following example demonstrates the use of this method to set the icon for the app notification button.
var notification = new AppNotificationBuilder()
.AddText("Notification text.")
.AddButton(new AppNotificationButton("Reply")
.AddArgument("action", "reply")
.SetIcon(new Uri("ms-appx:///Images/Reply.png")))
.BuildNotification();
AppNotificationManager.Default.Show(notification);
The resulting XML payload if the urgent scenario is supported:
<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 with the AppNotificationButton.Icon.
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.