Skip to content

Latest commit

 

History

History
69 lines (45 loc) · 1.96 KB

appnotificationbuilder_setinlineimage_167721551.md

File metadata and controls

69 lines (45 loc) · 1.96 KB
-api-id -api-type
M:Microsoft.Windows.AppNotifications.Builder.AppNotificationBuilder.SetInlineImage(Windows.Foundation.Uri)
winrt method

Microsoft.Windows.AppNotifications.Builder.AppNotificationBuilder.SetInlineImage(Windows.Foundation.Uri)

-description

Sets the image that is displayed inline, after any text elements, filling the full width of the visual area in an app notification.

-parameters

-param imageUri

The URI of the inline image file.

-returns

Returns the AppNotificationBuilder instance so that additional method calls can be chained.

-remarks

The following screenshot illustrates the placement of the inline image.

:::image type="content" source="images/toast-content-inline-image.png" alt-text="A screenshot of an app notification with an inline image.":::

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.

-see-also

-examples

The following example demonstrates setting an inline image in the XML payload for an app notification.

var notification = new AppNotificationBuilder()
    .AddText("Notification text.")
    .SetInlineImage(new Uri("ms-appx:///Images/InlineImage.png"))
    .BuildNotification();

AppNotificationManager.Default.Show(notification);

The resulting XML payload:

<toast>
    <visual>
        <binding template='ToastGeneric'>
            <text>Notification text.</text>
            <image src='ms-appx:///Images/InlineImage.png'/>
        </binding>
    </visual>
</toast>