Back to Devexpress

SuperToolTip Class

windowsforms-devexpress-dot-utils-896f2ed3.md

latest15.0 KB
Original Source

SuperToolTip Class

Represents a tooltip that supports multiple text and image regions.

Namespace : DevExpress.Utils

Assembly : DevExpress.Utils.v25.2.dll

NuGet Packages : DevExpress.Utils, DevExpress.Wpf.Core

Declaration

csharp
public class SuperToolTip :
    BaseToolTipObject,
    ICloneable,
    ISerializable
vb
Public Class SuperToolTip
    Inherits BaseToolTipObject
    Implements ICloneable,
               ISerializable

The following members return SuperToolTip objects:

Show 37 links

LibraryRelated API Members
WinForms ControlsAccordionControlElementBase.SuperTip
AppMenuFileLabel.ImageSuperTip
AppMenuFileLabel.SelectedImageSuperTip
BackstageViewItem.SuperTip
BarButtonItem.SuperTip
BarItem.DropDownSuperTip
BarItem.SuperTip
BarItemLink.GetSuperTip()
BaseControl.SuperTip
ContextItem.SuperTip
DefaultToolTipController.GetSuperTip(Control)
Document.SuperTip
Document.SuperTip
DXMenuItem.SuperTip
EditorButton.SuperTip
GalleryItem.SuperTip
GanttTaskToolTipShowingEventArgs.SuperTip
GanttTimelineTaskToolTipShowingEventArgs.SuperTip
IButtonProperties.SuperTip
NavElement.SuperTip
NavElement.SuperTip
NavigationBarItem.SuperTip
NavigationPage.SuperTip
RecentItemBase.SuperTip
RibbonControl.ApplicationButtonSuperTip
RibbonPageGroup.SuperTip
SvgImageBox.SuperTip
SvgImageItem.SuperTip
TabFormPage.SuperTip
TabNavigationPage.SuperTip
TileItem.SuperTip
ToolTipControlInfo.SuperTip
ToolTipController.GetSuperTip(Control)
ToolTipControllerShowEventArgs.SuperTip
XtraMdiTabPage.SuperTip
XtraTabPage.SuperTip
DashboardDashboardToolbarItem.SuperTip

Remarks

The SuperToolTip class represents a super tooltip. A super tooltip consists of multiple regions (items): title, content, separator, and footer. Items are arranged one under another. Each item can display an image and text. A tooltip can contain any combination of items.

The following types specify tooltip items:

  • ToolTipItem — the main region in a super tooltip that displays text and/or image.
  • ToolTipTitleItem — a region displayed at the top (title) or bottom (footer) of a tooltip. This type differs from the regular type by its default appearance and indentation settings.
  • ToolTipSeparatorItem — a horizontal line in a tooltip.

To create a tooltip, add tooltip items to the Items collection. Items are displayed according to their order in the collection.

The Setup(SuperToolTipSetupArgs) method allows you to create a super tooltip with three predefined regions: header, contents, and footer.

See Hints and Tooltips for more information.

Examples

The following examples demonstrate two different approaches to create a super tooltip ( SuperToolTip ) and assign in to a bar item. The super tooltip includes the title, main content, separator, and footer.

Example 1

csharp
using DevExpress.Utils;

private void Form1_Load(object sender, EventArgs e) {
  CreateSuperTooltip(barButtonItemChart);
}

void CreateSuperTooltip(BarItem barItem) {
  SuperToolTip superTip = new SuperToolTip();
  ToolTipItem item = new ToolTipItem();
  if(barItem.ImageOptions.SvgImage != null)
      item.ImageOptions.SvgImage = barItem.ImageOptions.SvgImage;
  item.Text = "Transform data to its most appropriate and readable visual representation. Insert bar charts, pie graphs, line graphs, or financial diagrams.";
  ToolTipItem footer = new ToolTipItem();
  superTip.AllowHtmlText = DefaultBoolean.True;
  footer.Text = "<a href=\"https://www.devexpress.com\">Learn more</a>";
  superTip.Items.AddTitle("Add a Chart");
  superTip.Items.Add(item);
  superTip.Items.AddSeparator();
  superTip.Items.Add(footer);
  barItem.SuperTip = superTip;
}
vb
Imports DevExpress.Utils

Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs)
    CreateSuperTooltip(barButtonItemChart)
End Sub

Private Sub CreateSuperTooltip(ByVal barItem As BarItem)
    Dim superTip As New SuperToolTip()
    Dim item As New ToolTipItem()
    If barItem.ImageOptions.SvgImage IsNot Nothing Then
        item.ImageOptions.SvgImage = barItem.ImageOptions.SvgImage
    End If
    item.Text = "Transform data to its most appropriate and readable visual representation. Insert bar charts, pie graphs, line graphs, or financial diagrams."
    Dim footer As New ToolTipItem()
    superTip.AllowHtmlText = DefaultBoolean.True
  footer.Text = "Learn more on www.devexpress.com"
    superTip.Items.AddTitle("Add a Chart")
    superTip.Items.Add(item)
    superTip.Items.AddSeparator()
    superTip.Items.Add(footer)
    barItem.SuperTip = superTip
End Sub

Example 2

Create the SuperToolTipSetupArgs object, customize its settings, and pass it to the SuperToolTip.Setup method.

csharp
using DevExpress.Utils;

private void Form1_Load(object sender, EventArgs e) {
  SetupSuperTooltip(barButtonItemChart);
}

void SetupSuperTooltip(BarItem barItem) {
  SuperToolTip superTip = new SuperToolTip();
  SuperToolTipSetupArgs args = new SuperToolTipSetupArgs();
  args.Title.Text = "Add a Chart";
  args.Contents.Text = "Transform data to its most appropriate and readable visual representation. Insert bar charts, pie graphs, line graphs, or financial diagrams.";
  if(barItem.ImageOptions.SvgImage != null)
      args.Contents.ImageOptions.SvgImage = barItem.ImageOptions.SvgImage;
  args.ShowFooterSeparator = true;
  args.Footer.Text = "<a href=\"https://www.devexpress.com\">Learn more</a>";
  superTip.Setup(args);
  superTip.AllowHtmlText = DefaultBoolean.True;
  barItem.SuperTip = superTip;
}
vb
Imports DevExpress.Utils

Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs)
    SetupSuperTooltip(barButtonItemChart)
End Sub

Private Sub SetupSuperTooltip(ByVal barItem As BarItem)
  Dim superTip As New SuperToolTip()
  Dim args As New SuperToolTipSetupArgs()
  args.Title.Text = "Add a Chart"
  args.Contents.Text = "Transform data to its most appropriate and readable visual representation. Insert bar charts, pie graphs, line graphs, or financial diagrams."
  If barItem.ImageOptions.SvgImage IsNot Nothing Then
      args.Contents.ImageOptions.SvgImage = barItem.ImageOptions.SvgImage
  End If
  args.ShowFooterSeparator = True
  args.Footer.Text = "Learn more on www.devexpress.com"
  superTip.Setup(args)
  barItem.SuperTip = superTip
End Sub

This example shows how to create a super tooltip with a hyperlink and assign it to a SimpleButton.

The button’s SuperTip property allows you to specify a super tooltip. Use the ToolTipController.AllowHtmlText, SuperToolTip.AllowHtmlText, or ToolTipItem.AllowHtmlText property to enable HTML tags. Handle the ToolTipController.HyperlinkClick event to respond to a click on the hyperlink.

The SuperToolTip Editor allows you to create super tooltips in the designer. To invoke the editor, click the SuperTip property’s ellipsis button in the Properties window.

If you create a tooltip in the designer, you still need to handle the HyperlinkClick event in code. Use the Properties window to assign an event handler.

The example below shows how to create a super tooltip in code.

csharp
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 { }
}
vb
Imports DevExpress.Utils

Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
    ' Access the controller that manages tooltips for all controls:
    Dim defaultTooltipController As ToolTipController = DevExpress.Utils.ToolTipController.DefaultController

    ' Create and customize a SuperToolTip:
    Dim sTooltip As New SuperToolTip()
    Dim args As 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:
    AddHandler defaultTooltipController.HyperlinkClick, AddressOf defaultTooltipController_HyperlinkClick

    ' Assign a SuperToolTip to the button:
    SimpleButton1.SuperTip = sTooltip
End Sub

Private Sub defaultTooltipController_HyperlinkClick(sender As Object, e As HyperlinkClickEventArgs)
    Dim process As New Process()
    process.StartInfo.FileName = (e.Link)
    process.StartInfo.Verb = "open"
    process.StartInfo.WindowStyle = ProcessWindowStyle.Normal
    Try
        process.Start()
    Catch
    End Try
End Sub

Inheritance

Object DevExpress.Utils.BaseToolTipObject SuperToolTip

See Also

SuperToolTip Members

Hints and Tooltips

DevExpress.Utils Namespace