-api-id | -api-type |
---|---|
M:Microsoft.Windows.AppNotifications.Builder.AppNotificationTextProperties.#ctor |
winrt constructor |
Initializes a new instance of the AppNotificationTextProperties class, which specifies display and localization properties for the text.
Add text with text properties to an app notification by calling AppNotificationBuilder.AddText.
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>