AppNotificationBuilder.SetAttributionText 方法

定義

多載

SetAttributionText(String, String)

設定代理程式更新的屬性文字。

SetAttributionText(String)

設定代理程式更新的屬性文字。

SetAttributionText(String, String)

設定代理程式更新的屬性文字。

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

參數

text
String

Platform::String

winrt::hstring

屬性文字。

language
String

Platform::String

winrt::hstring

字串包含指定屬性文字語言的 IETF 語言標籤。

傳回

傳回 AppNotificationBuilder 實例,以便鏈結其他方法呼叫。

屬性

範例

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

AppNotificationManager.Default.Show(notification);

產生的 XML 承載:

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

備註

下圖顯示代理程式更新上屬性文字的位置。

已覆寫屬性文字的代理程式更新螢幕擷取畫面。

如需使用 AppNotificationBuilder API 建立代理程式更新 UI 的指引,請參閱 代理程式更新內容

如需代理程式更新之 XML 架構的參考資訊,請參閱 代理程式更新內容架構

適用於

SetAttributionText(String)

設定代理程式更新的屬性文字。

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

參數

text
String

Platform::String

winrt::hstring

屬性文字。

傳回

傳回 AppNotificationBuilder 實例,以便鏈結其他方法呼叫。

屬性

範例

下列範例示範如何在代理程式更新的 XML 承載中設定屬性文字。

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

AppNotificationManager.Default.Show(notification);

產生的 XML 承載:

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

備註

下圖顯示代理程式更新上屬性文字的位置。

已覆寫屬性文字的代理程式更新螢幕擷取畫面。

如需使用 AppNotificationBuilder API 建立代理程式更新 UI 的指引,請參閱 代理程式更新內容

如需代理程式更新之 XML 架構的參考資訊,請參閱 代理程式更新內容架構

適用於