AppNotificationTextProperties Class

Definition

Specifies display and localization properties for text displayed on an app notification.

public ref class AppNotificationTextProperties sealed
/// [Windows.Foundation.Metadata.Activatable(65536, "Microsoft.Windows.AppNotifications.Builder.AppNotificationBuilderContract")]
/// [Windows.Foundation.Metadata.ContractVersion(Microsoft.Windows.AppNotifications.Builder.AppNotificationBuilderContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class AppNotificationTextProperties final
[Windows.Foundation.Metadata.Activatable(65536, "Microsoft.Windows.AppNotifications.Builder.AppNotificationBuilderContract")]
[Windows.Foundation.Metadata.ContractVersion(typeof(Microsoft.Windows.AppNotifications.Builder.AppNotificationBuilderContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public sealed class AppNotificationTextProperties
function AppNotificationTextProperties()
Public NotInheritable Class AppNotificationTextProperties
Inheritance
Object Platform::Object IInspectable AppNotificationTextProperties
Attributes

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>

Remarks

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

Constructors

AppNotificationTextProperties()

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

Properties

IncomingCallAlignment

Gets or sets a value specifying whether the associated text is aligned for an incoming call.

Language

Gets or sets a value specifying the language of the associated text.

MaxLines

Gets or sets the maximum number of lines the associated text should span.

Methods

SetIncomingCallAlignment()

Sets a value specifying whether the associated text is displayed with incoming call alignment.

SetLanguage(String)

Sets a value specifying the language of the associated text.

SetMaxLines(Int32)

Sets the maximum number of lines the associated text should span.

Applies to