AppNotificationTextProperties 构造函数

定义

初始化 AppNotificationTextProperties 类的新实例,该类指定文本的显示和本地化属性。

public:
 AppNotificationTextProperties();
 AppNotificationTextProperties();
public AppNotificationTextProperties();
function AppNotificationTextProperties()
Public Sub New ()

示例

以下示例演示如何将文本块添加到应用通知的 XML 有效负载。

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

AppNotificationManager.Default.Show(notification);

生成的 XML 有效负载:

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

注解

通过调用 AppNotificationBuilder.AddText,将具有文本属性的文本添加到应用通知。

适用于