I have been reading a lot of posts pertaining to setting tooltips for a cell, however I have seen nothing that addresses, displaying tooltips based on ValueBasedAppearance.
In my scenario I am creating ValueBasedAppearences at runtime. This occurs as part of Initialization. In many cases the ValueBasedAppearence sets up the use of 1 of many images to be displayed along with the data in the cell. What I would like to do is set the tooltip of the cell based on the ValueBasedAppearence.
Is this possible?
Is there another way to do this?
HI,
Each Cell in the WinGrid has a ToolTipText.
You can set this property in the WinGrids InitializeRow event.
Here is a code snippet:
private void ultraGrid1_InitializeRow(object sender, Infragistics.Win.UltraWinGrid.InitializeRowEventArgs e) { int id = (int) e.Row.Cells[0].Value; switch (id) { case 1: { e.Row.Cells[0].ToolTipText = "big boss " + id; break; } case 2: { e.Row.Cells[0].ToolTipText = "2nd banana " + id; break; }
default: { e.Row.Cells[0].ToolTipText = "every body else " + id; break;
} }
Sincerely,
MattDeveloper Support Engineer
I am just following up on this forum post.
Plesae let me know if you had additional questions regarding UltraGridCell'sTooltips.
Matt
Developer Support Engineer
Matt,
Just wanted to summarize the solution.
At the time that the ConditionValueAppearance object is set, usually within InitializeLayout, on the image set the tag property to your tooltip.
Dim objAppearance As New Infragistics.Win.Appearance()
objAppearance.Image = PIC.GetGridColumnImage(CType(.Item(RowCount).Item("ImageEnum"), eEnum.eGridColumnImageValue))Dim img As Image = DirectCast(objAppearance.Image, Image)img.Tag = .Item(RowCount).Item("ToolTip")
Then in the MouseEnterElement event get a handle on the cell and set the tooltip.
Dim el As Infragistics.Win.UIElement = Me.tsiListView.DisplayLayout.UIElement.ElementFromPoint( _ tsiListView.PointToClient(New Point(Control.MousePosition.X, Control.MousePosition.Y)))
Dim objCellElement As CellUIElement = CType(el.GetAncestor(GetType(Infragistics.Win.UltraWinGrid.CellUIElement)), CellUIElement)
Dim objCell As UltraGridCell = CType(objCellElement.GetContext(GetType(UltraGridCell)), UltraGridCell)
Dim appdata As New AppearanceData()objCell.ResolveAppearance(appdata)If Not DirectCast(appdata.Image, Image).Tag Is DBNull.Value Then If DirectCast(appdata.Image, Image).Tag.ToString().Length > 0 Then objCell.ToolTipText = DirectCast(appdata.Image, Image).Tag.ToString() End IfEnd If
Thanks