語言

AppNotificationButton.ToolTip 屬性

定義

取得或設定應用程式通知按鈕的工具提示文字。

public:
 property Platform::String ^ ToolTip { Platform::String ^ get(); void set(Platform::String ^ value); };
winrt::hstring ToolTip();

void ToolTip(winrt::hstring value);
public string ToolTip { get; set; }
var string = appNotificationButton.toolTip;
appNotificationButton.toolTip = string;
Public Property ToolTip As String

屬性值

String

Platform::String

winrt::hstring

包含提示文字的字串。

範例

以下範例示範如何使用此屬性來設定應用程式通知按鈕的工具提示。

var button = new AppNotificationButton("Reply")
    .AddArgument("action", "reply");

if (AppNotificationButton.IsToolTipSupported())
{
    button.ToolTip = "Click to reply.";
}

var notification = new AppNotificationBuilder()
    .AddText("Notification text.")
    .AddButton(button)
    .BuildNotification();

AppNotificationManager.Default.Show(notification);

若支援緊急情境,所得 XML 有效載荷如下:

<toast>
    <visual>
        <binding template='ToastGeneric'>
            <text>Notification text.</text>
        </binding>
    </visual>
    <actions>
        <action content='Reply' arguments='action=reply' hint-toolTip='Click to reply'/>
    </actions>
</toast>

備註

你也可以透過呼叫 AppNotificationButton.SetToolTip) 方法來設定提示文字。

提示文字僅支援 Windows 10 Build 19041 及以後版本。 請呼叫 AppNotificationButton.IsToolTipSupported ,以在執行時判斷目前裝置是否支援提示。

如需使用 AppNotificationBuilder API 來建立應用程式通知 UI 的指引,請參閱 應用程式通知內容。

如需應用程式通知 XML 架構的參考資訊,請參閱 應用程式通知內容架構。

適用於