SuperToolTip.AllowHtmlText Property
Gets or sets whether HTML formatting is allowed in the current SuperToolTip object.
Namespace: DevExpress.Utils
Assembly: DevExpress.Utils.v19.2.dll
Declaration
[DefaultValue(DefaultBoolean.Default)]
public virtual DefaultBoolean AllowHtmlText { get; set; }
Property Value
Type | Default | Description |
---|---|---|
DefaultBoolean | **Default** | A DefaultBoolean value that specifies whether HTML formatting is allowed in the tooltip. |
Available values:
Name | Description |
---|---|
True | Corresponds to a Boolean value of true. |
False | Corresponds to a Boolean value of false. |
Default | The value is determined by the current object’s parent object setting (e.g., a control setting). |
Remarks
You can use HTML tags to format text in tooltips, provided that a corresponding feature is enabled.
If the AllowHtmlText property is set to True, the HTML formatting feature is enabled for this SuperToolTip. If the AllowHtmlText property is set to Default, the HTML formatting feature is enabled if a corresponding ToolTipController’s ToolTipController.AllowHtmlText property is set to true.
For detailed information on supported HTML tags, see HTML Text Formatting.
Example
This example shows how to use HTML formatting when creating a SuperToolTip. The result is displayed below:
using DevExpress.Utils;
SuperToolTip sTooltip = new SuperToolTip();
// Create an object to initialize the SuperToolTip.
SuperToolTipSetupArgs args = new SuperToolTipSetupArgs();
args.Title.Text = "<color=255,0,0>New Feature</color>";
args.Contents.Text = "This <b>SuperToolTip</b> supports <i>HTML formatting</i>";
sTooltip.Setup(args);
// Enable HTML formatting.
sTooltip.AllowHtmlText = DefaultBoolean.True;
// Assign the SuperToolTip to a control.
radioGroup1.SuperTip = sTooltip;
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 { }
}