Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
125
How to display ToolTip in Row Header
posted
Dear All,
Is there any way to display tool tip in the row header?
 
For example, we can display tool tip in the column header using,
 
band.Columns["Column_Name"].Header.Appearance.ForegroundAlpha = Alpha.Transparent;
 
 
In this case, the column header text will be empty, but when mouse is moved over the column header then the above tool tip will be displayed.
 
Is it possible to do the same in the row header? Please let me know.
Thanks & Regards,
 
Kannan
  • 5118
    posted

    Hello Kannan,

     The picture you placed in the post isn't loading for me so I built out all the parts of the "headers" for the UltraGrid to show the tooltips for each part.  There are numerous ways to accomplish this task... first I did it with a DrawFilter, then I did it with a CreationFilter and finally I went the normal route and did it without any filters... here is my final solution to setting tooltips on items:

    using Infragistics.Win;

    using Infragistics.Win.UltraWinGrid;

    namespace WinGridRowHeaderTooltips

    {

        public partial class Form1 : Form

        {

            public Form1()

            {

                InitializeComponent();

            }

            private MyTooltip myRowSelectorHeaderTooltip;

            private void Form1_Load(object sender, EventArgs e)

            {

                this.ultraGrid1.DataSource = LoadGrid();

                myRowSelectorHeaderTooltip = new MyTooltip();

            }

            private DataTable LoadGrid()

            {

                DataTable dt = new DataTable();

                dt.Columns.Add("Col0", typeof(int));

                dt.Columns.Add("Col1", typeof(string));

                dt.Columns.Add("Col2", typeof(bool));

                DataRow dr;

                for (int i = 0; i < 20; i++)

                {

                    dr = dt.NewRow();

                    dr[0] = i;

                    dr[1] = "Value is: " + i.ToString();

                    dr[2] = i % 2;

                    dt.Rows.Add(dr);

                }

                return dt;

            }

            private void ultraGrid1_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e)

            {

                e.Layout.Override.RowSelectors = Infragistics.Win.DefaultableBoolean.True;

                e.Layout.Override.RowSelectorHeaderStyle = Infragistics.Win.UltraWinGrid.RowSelectorHeaderStyle.SeparateElement;

                // column header tooltip settings

                e.Layout.Bands[0].Columns[0].Header.ToolTipText = "tooltip text for column header of col 0";

                // row selector tooltip settings

                e.Layout.Rows[0].ToolTipText = "tooltip text for row 0";

                e.Layout.Rows[2].ToolTipText = "tooltip text for row 2";

                e.Layout.Override.TipStyleHeader = Infragistics.Win.UltraWinGrid.TipStyle.Show;

            }

            private void ultraGrid1_MouseEnterElement(object sender, UIElementEventArgs e)

            {

                if (e.Element is RowSelectorHeaderUIElement)

                {

                    e.Element.ToolTipItem = myRowSelectorHeaderTooltip;

                }

            }

        }

        class MyTooltip : IToolTipItem

        {

            #region IToolTipItem Members

                public ToolTipInfo GetToolTipInfo(Point mousePosition, UIElement element, UIElement previousToolTipElement, ToolTipInfo toolTipInfoDefault)

                {

                    toolTipInfoDefault.ToolTipText = "Row Selector Header UI Element ToolTip Text!";

                    return toolTipInfoDefault;

                }

            #endregion

        }

    }