AppNotificationButton.SetToolTip(String) Method

Definition

Sets the tool-tip text for the app notification button.

public:
 virtual AppNotificationButton ^ SetToolTip(Platform::String ^ value) = SetToolTip;
AppNotificationButton SetToolTip(winrt::hstring const& value);
public AppNotificationButton SetToolTip(string value);
function setToolTip(value)
Public Function SetToolTip (value As String) As AppNotificationButton

Parameters

value
String

Platform::String

winrt::hstring

A string containing the tool-tip text.

Returns

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

Examples

The following example demonstrates the use of this method to set the tool-tip for the app notification button.

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

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

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

AppNotificationManager.Default.Show(notification);

The resulting XML payload if the urgent scenario is supported:

<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>

Remarks

You can also set the tool-tip text by using the AppNotificationButton.ToolTip property.

Tool-tip text is only supported for on Windows 10 Build 19041 and later. Call AppNotificationButton.IsToolTipSupported to determine at runtime if tool-tips are supported on the current device.

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