AppNotificationBuilder.SetInlineImage Method

Definition

Overloads

SetInlineImage(Uri)

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

SetInlineImage(Uri, AppNotificationImageCrop)

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

SetInlineImage(Uri, AppNotificationImageCrop, String)

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

SetInlineImage(Uri)

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

public:
 virtual AppNotificationBuilder ^ SetInlineImage(Uri ^ imageUri) = SetInlineImage;
/// [Windows.Foundation.Metadata.Overload("SetInlineImage")]
AppNotificationBuilder SetInlineImage(Uri const& imageUri);
[Windows.Foundation.Metadata.Overload("SetInlineImage")]
public AppNotificationBuilder SetInlineImage(System.Uri imageUri);
function setInlineImage(imageUri)
Public Function SetInlineImage (imageUri As Uri) As AppNotificationBuilder

Parameters

imageUri
Uri Uri

The URI of the inline image file.

Returns

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

Attributes

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>

Remarks

The following screenshot illustrates the placement of the inline image.

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.

Applies to

SetInlineImage(Uri, AppNotificationImageCrop)

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

public:
 virtual AppNotificationBuilder ^ SetInlineImage(Uri ^ imageUri, AppNotificationImageCrop imageCrop) = SetInlineImage;
/// [Windows.Foundation.Metadata.Overload("SetInlineImage2")]
AppNotificationBuilder SetInlineImage(Uri const& imageUri, AppNotificationImageCrop const& imageCrop);
[Windows.Foundation.Metadata.Overload("SetInlineImage2")]
public AppNotificationBuilder SetInlineImage(System.Uri imageUri, AppNotificationImageCrop imageCrop);
function setInlineImage(imageUri, imageCrop)
Public Function SetInlineImage (imageUri As Uri, imageCrop As AppNotificationImageCrop) As AppNotificationBuilder

Parameters

imageUri
Uri Uri

The URI of the inline image file.

imageCrop
AppNotificationImageCrop

A member of the AppNotificationImageCrop enumeration specifying the cropping method.

Returns

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

Attributes

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"), AppNotificationImageCrop.Circle, "Alternate text")
    .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' alt='Alternate text' hint-crop='circle'/>
        </binding>
    </visual>
</toast>

Remarks

The following screenshot illustrates the placement of the inline image.

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.

Applies to

SetInlineImage(Uri, AppNotificationImageCrop, String)

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

public:
 virtual AppNotificationBuilder ^ SetInlineImage(Uri ^ imageUri, AppNotificationImageCrop imagecrop, Platform::String ^ alternateText) = SetInlineImage;
/// [Windows.Foundation.Metadata.Overload("SetInlineImage3")]
AppNotificationBuilder SetInlineImage(Uri const& imageUri, AppNotificationImageCrop const& imagecrop, winrt::hstring const& alternateText);
[Windows.Foundation.Metadata.Overload("SetInlineImage3")]
public AppNotificationBuilder SetInlineImage(System.Uri imageUri, AppNotificationImageCrop imagecrop, string alternateText);
function setInlineImage(imageUri, imagecrop, alternateText)
Public Function SetInlineImage (imageUri As Uri, imagecrop As AppNotificationImageCrop, alternateText As String) As AppNotificationBuilder

Parameters

imageUri
Uri Uri

The URI of the inline image file.

imagecrop
AppNotificationImageCrop

A member of the AppNotificationImageCrop enumeration specifying the cropping method.

alternateText
String

Platform::String

winrt::hstring

A string containing the alternate text for the inline image.

Returns

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

Attributes

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"), 
        AppNotificationImageCrop.Default)
    .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' alt='Alternate text'/>
        </binding>
    </visual>
</toast>

Remarks

The following screenshot illustrates the placement of the inline image.

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.

Applies to