Skip to content

Latest commit

 

History

History
47 lines (31 loc) · 1.31 KB

appnotificationtextproperties_appnotificationtextproperties_1221375020.md

File metadata and controls

47 lines (31 loc) · 1.31 KB
-api-id -api-type
M:Microsoft.Windows.AppNotifications.Builder.AppNotificationTextProperties.#ctor
winrt constructor

Microsoft.Windows.AppNotifications.Builder.AppNotificationTextProperties.#ctor

-description

Initializes a new instance of the AppNotificationTextProperties class, which specifies display and localization properties for the text.

-remarks

Add text with text properties to an app notification by calling AppNotificationBuilder.AddText.

-see-also

-examples

The following example demonstrates adding a text block to the XML payload for an app notification.

var notification = new AppNotificationBuilder()
    .AddText("Notification text.", new AppNotificationTextProperties().SetMaxLines(2))
    .BuildNotification();

AppNotificationManager.Default.Show(notification);

The resulting XML payload:

<toast>
    <visual>
        <binding template='ToastGeneric'>
            <text hint-maxLines='2'>Notification text.</text>
        </binding>
    </visual>
</toast>