Back to Devexpress

SuperToolTip.Setup(SuperToolTipSetupArgs) Method

windowsforms-devexpress-dot-utils-dot-supertooltip-dot-setup-x28-devexpress-dot-utils-dot-supertooltipsetupargs-x29.md

latest6.2 KB
Original Source

SuperToolTip.Setup(SuperToolTipSetupArgs) Method

Creates tooltip items based on the specified setup information.

Namespace : DevExpress.Utils

Assembly : DevExpress.Utils.v25.2.dll

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

Declaration

csharp
public virtual void Setup(
    SuperToolTipSetupArgs info
)
vb
Public Overridable Sub Setup(
    info As SuperToolTipSetupArgs
)

Parameters

NameTypeDescription
infoDevExpress.Utils.SuperToolTipSetupArgs

A DevExpress.Utils.SuperToolTipSetupArgs object which contains initialization information.

|

Remarks

The Setup method removes existing tooltip items by clearing the SuperToolTip.Items collection. Then, it adds new tooltip items to the SuperToolTip.Items collection based on the information provided by the info parameter.

A DevExpress.Utils.SuperToolTipSetupArgs object provides the Title , Contents and Footer properties which represent tooltip items. The Setup method copies these tooltip items to the SuperToolTip.Items collection, provided that these properties have been initialized.

In addition, the DevExpress.Utils.SuperToolTipSetupArgs object contains the AllowHtmlText property. The Setup method copies this property’s value to the SuperToolTip’s SuperToolTip.AllowHtmlText property.

Example

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

See Also

Items

SuperToolTip Class

SuperToolTip Members

DevExpress.Utils Namespace