A newer version of this page is available. Switch to the current version.

ToolTipController.HyperlinkClick Event

Occurs when an end-user clicks a hyperlink within a control's tool-tip or super tool-tip.

Namespace: DevExpress.Utils

Assembly: DevExpress.Utils.v19.1.dll

Declaration

[DXCategory("Action")]
public event HyperlinkClickEventHandler HyperlinkClick
<DXCategory("Action")>
Public Event HyperlinkClick As HyperlinkClickEventHandler

Event Data

The HyperlinkClick event's data class is DevExpress.Utils.HyperlinkClickEventArgs.

Remarks

You can insert hyperlinks in tooltips via the <href></href> tag if HTML Text Formatting is enabled. To learn how to enable this feature, see the ToolTipController.AllowHtmlText topic.

ToolTip - Hyperlink

Clicking a hyperlink within a tooltip fires the HyperlinkClick event. Handle it to perform the desired actions (e.g., open a browser or an e-mail client).

Examples

This example shows how to create a SuperToolTip containing a hyperlink for a SimpleButton.

The SimpleButton control provides the BaseControl.SuperTip inherited property that allows you to set a tooltip. To enable use of the <href> tag and other HTML text formatting tags in tooltips, activate the HTML Text Formatting feature (for instance, via the SuperToolTip.AllowHtmlText property). To respond to clicking a hyperlink, handle the ToolTipController.HyperlinkClick event.

The code that creates a SuperToolTip for a button is shown at the end of this section. At design time, you can create a SuperToolTip for a button as shown below. In this case, you still need to implement the HyperlinkClick event in code.

At design time, select the SimpleButton control and click the ellipses button within the SuperTip row in the Properties window:

SimpleButton-SuperTip property

This invokes the SuperToolTip Editor, which allows you to set the tooltip content and activate the HTML formatting feature:

ToolTipController - Designer

When you run the application, the result will be as follows:

ToolTipController - HyperlinkClick

using DevExpress.Utils;
using System.Diagnostics;

private void Form1_Load(object sender, EventArgs e) {
    // Access the controller that manages tooltips for all controls:
    ToolTipController defaultTooltipController = DevExpress.Utils.ToolTipController.DefaultController;

    // Create and customize a SuperToolTip:
    SuperToolTip sTooltip = new SuperToolTip();
    SuperToolTipSetupArgs args = new SuperToolTipSetupArgs();
    args.Title.Text = "Header";
    args.Contents.Text = "This tooltip contains a hyperlink. Visit the <href=http://help.devexpress.com>DevExpress Knowledge Center</href> to learn more.";
    args.ShowFooterSeparator = true;
    args.Footer.Text = "Footer";
    sTooltip.Setup(args);
    // Enable HTML Text Formatting for the created SuperToolTip:
    sTooltip.AllowHtmlText = DefaultBoolean.True;
    //..or enable this feature for all tooltips:
    //defaultTooltipController.AllowHtmlText = true;

    // Respond to clicking hyperlinks in tooltips:
    defaultTooltipController.HyperlinkClick += defaultTooltipController_HyperlinkClick;

    // Assign a SuperToolTip to the button:
    simpleButton1.SuperTip = sTooltip;
}

void defaultTooltipController_HyperlinkClick(object sender, HyperlinkClickEventArgs e) {
    Process process = new Process();
    process.StartInfo.FileName = (e.Link);
    process.StartInfo.Verb = "open";
    process.StartInfo.WindowStyle = ProcessWindowStyle.Normal;
    try {
        process.Start();
    }
    catch { }
}
See Also