Share via


AppNotificationBuilder.SetAttributionText Method

Definition

Overloads

SetAttributionText(String, String)

Sets the attribution text for an app notification.

SetAttributionText(String)

Sets the attribution text for an app notification.

SetAttributionText(String, String)

Sets the attribution text for an app notification.

public:
 virtual AppNotificationBuilder ^ SetAttributionText(Platform::String ^ text, Platform::String ^ language) = SetAttributionText;
/// [Windows.Foundation.Metadata.Overload("SetAttributionText2")]
AppNotificationBuilder SetAttributionText(winrt::hstring const& text, winrt::hstring const& language);
[Windows.Foundation.Metadata.Overload("SetAttributionText2")]
public AppNotificationBuilder SetAttributionText(string text, string language);
function setAttributionText(text, language)
Public Function SetAttributionText (text As String, language As String) As AppNotificationBuilder

Parameters

text
String

Platform::String

winrt::hstring

The attribution text.

language
String

Platform::String

winrt::hstring

A string containg an IETF language tag specifying the language of the attribution text.

Returns

Returns the AppNotificationBuilder instance so that additional method calls can be chained.

Attributes

Examples

var notification = new AppNotificationBuilder()
    .AddText("Notification text.")
    .SetAttributionText("Attribution text", "en-US")
    .BuildNotification();

AppNotificationManager.Default.Show(notification);

The resulting XML payload:

<toast>
    <visual>
        <binding template='ToastGeneric'>
            <text>Notification text.</text>
            <text placement='attribution' lang='en-US'>Attribution text</text>
        </binding>
    </visual>
</toast>

Remarks

The following image shows the placement of attribution text on an app notification.

A screenshot of an app notification with overridden attribution text.

For guidance on using the AppNotificationBuilder APIs to create the UI for app notifications, see App notification content.

For reference information about the XML schema for app notifications, see App notification content schema.

Applies to

SetAttributionText(String)

Sets the attribution text for an app notification.

public:
 virtual AppNotificationBuilder ^ SetAttributionText(Platform::String ^ text) = SetAttributionText;
/// [Windows.Foundation.Metadata.Overload("SetAttributionText")]
AppNotificationBuilder SetAttributionText(winrt::hstring const& text);
[Windows.Foundation.Metadata.Overload("SetAttributionText")]
public AppNotificationBuilder SetAttributionText(string text);
function setAttributionText(text)
Public Function SetAttributionText (text As String) As AppNotificationBuilder

Parameters

text
String

Platform::String

winrt::hstring

The attribution text.

Returns

Returns the AppNotificationBuilder instance so that additional method calls can be chained.

Attributes

Examples

The following example demonstrates setting the attribution text in the XML payload for an app notification.

var notification = new AppNotificationBuilder()
    .AddText("Notification text.")
    .SetAttributionText("Attribution text")
    .BuildNotification();

AppNotificationManager.Default.Show(notification);

The resulting XML payload:

<toast>
    <visual>
        <binding template='ToastGeneric'>
            <text>Notification text.</text>
            <text placement='attribution'>Attribution text</text>
        </binding>
    </visual>
</toast>

Remarks

The following image shows the placement of attribution text on an app notification.

A screenshot of an app notification with overridden attribution text.

For guidance on using the AppNotificationBuilder APIs to create the UI for app notifications, see App notification content.

For reference information about the XML schema for app notifications, see App notification content schema.

Applies to