Share via


AppNotificationImageCrop Enum

Definition

Specifies the cropping options for an image in an AppNotification.

public enum class AppNotificationImageCrop
/// [Windows.Foundation.Metadata.ContractVersion(Microsoft.Windows.AppNotifications.Builder.AppNotificationBuilderContract, 65536)]
enum class AppNotificationImageCrop
[Windows.Foundation.Metadata.ContractVersion(typeof(Microsoft.Windows.AppNotifications.Builder.AppNotificationBuilderContract), 65536)]
public enum AppNotificationImageCrop
var value = Microsoft.Windows.AppNotifications.Builder.AppNotificationImageCrop.default
Public Enum AppNotificationImageCrop
Inheritance
AppNotificationImageCrop
Attributes

Fields

Name Value Description
Default 0

Default. No cropping.

Circle 1

Circular cropping.

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

Set the crop for an app notification image in the call to AppNotificationBuilder.SetInlineImage).

Applies to