ToastContentBuilder.AddText Method

Definition

Add text to the toast.

public Microsoft.Toolkit.Uwp.Notifications.ToastContentBuilder AddText (string text, Microsoft.Toolkit.Uwp.Notifications.AdaptiveTextStyle? hintStyle = default, bool? hintWrap = default, int? hintMaxLines = default, int? hintMinLines = default, Microsoft.Toolkit.Uwp.Notifications.AdaptiveTextAlign? hintAlign = default, string language = default);
member this.AddText : string * Nullable<Microsoft.Toolkit.Uwp.Notifications.AdaptiveTextStyle> * Nullable<bool> * Nullable<int> * Nullable<int> * Nullable<Microsoft.Toolkit.Uwp.Notifications.AdaptiveTextAlign> * string -> Microsoft.Toolkit.Uwp.Notifications.ToastContentBuilder
Public Function AddText (text As String, Optional hintStyle As Nullable(Of AdaptiveTextStyle) = Nothing, Optional hintWrap As Nullable(Of Boolean) = Nothing, Optional hintMaxLines As Nullable(Of Integer) = Nothing, Optional hintMinLines As Nullable(Of Integer) = Nothing, Optional hintAlign As Nullable(Of AdaptiveTextAlign) = Nothing, Optional language As String = Nothing) As ToastContentBuilder

Parameters

text
String

Custom text to display on the tile.

hintStyle
Nullable<AdaptiveTextStyle>

This property is not used. Setting this has no effect.

hintWrap
Nullable<Boolean>

This property is not used. Setting this has no effect. If you need to disable wrapping, set hintMaxLines to 1.

hintMaxLines
Nullable<Int32>

The maximum number of lines the text element is allowed to display.

hintMinLines
Nullable<Int32>

hintMinLines is not used. Setting this has no effect.

hintAlign
Nullable<AdaptiveTextAlign>

hintAlign is not used. Setting this has no effect.

language
String

The target locale of the XML payload, specified as a BCP-47 language tags such as "en-US" or "fr-FR". The locale specified here overrides any other specified locale, such as that in binding or visual.

Returns

The current instance of ToastContentBuilder

Exceptions

Throws when attempting to add/reserve more than 4 lines on a single toast.

Throws when hintMaxLines value is larger than 2.

Remarks

More info at: https://docs.microsoft.com/en-us/windows/uwp/design/shell/tiles-and-notifications/adaptive-interactive-toasts#text-elements

Applies to