Share via


AppNotificationButton.ToolTip Property

Definition

Gets or sets the tool-tip text for the app notification button.

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

Property Value

String

Platform::String

winrt::hstring

A string containing the tool-tip text.

Examples

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

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

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 calling the AppNotificationButton.SetToolTip method.

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