Example E580
Visible to All Users

WinForms TreeList - Customize cell tooltips (hints)

This example shows how to handle the ToolTipController.GetActiveObjectInfo event to customize the tooltips displayed for TreeList cells:

C#
private void toolTipController1_GetActiveObjectInfo(object sender, DevExpress.Utils.ToolTipControllerGetActiveObjectInfoEventArgs e) { if(e.SelectedControl is DevExpress.XtraTreeList.TreeList) { TreeList tree = (TreeList)e.SelectedControl; TreeListHitInfo hit = tree.CalcHitInfo(e.ControlMousePosition); if(hit.HitInfoType == HitInfoType.Cell) { object cellInfo = new TreeListCellToolTipInfo(hit.Node, hit.Column, null); string toolTip = string.Format("{0} (Column: {1}, Node ID: {2})", hit.Node[hit.Column], hit.Column.FieldName, hit.Node.Id); e.Info = new DevExpress.Utils.ToolTipControlInfo(cellInfo, toolTip); } } }

Files to Review

Documentation

See Also

Does this example address your development requirements/objectives?

(you will be redirected to DevExpress.com to submit your response)

Example Code

Form1.cs(vb)
C#
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using DevExpress.XtraTreeList; using DevExpress.XtraTreeList.ViewInfo; namespace CustomTooltip { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { new DevExpress.XtraTreeList.Design.XViews(treeList1); } private void toolTipController1_GetActiveObjectInfo(object sender, DevExpress.Utils.ToolTipControllerGetActiveObjectInfoEventArgs e) { if(e.SelectedControl is DevExpress.XtraTreeList.TreeList) { TreeList tree = (TreeList)e.SelectedControl; TreeListHitInfo hit = tree.CalcHitInfo(e.ControlMousePosition); if(hit.HitInfoType == HitInfoType.Cell) { object cellInfo = new TreeListCellToolTipInfo(hit.Node, hit.Column, null); string toolTip = string.Format("{0} (Column: {1}, Node ID: {2})", hit.Node[hit.Column], hit.Column.FieldName, hit.Node.Id); e.Info = new DevExpress.Utils.ToolTipControlInfo(cellInfo, toolTip); } } } } }

Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.