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
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.
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).
Example
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:
This invokes the SuperToolTip Editor, which allows you to set the tooltip content and activate the HTML formatting feature:
When you run the application, the result will be as follows:
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 { }
}