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
Hi,
Elfmanne said:In my scenario I am creating ValueBasedAppearences at runtime.
Just FYI - ValueBasedAppearances are really useful if you want to set up appearances at design-time. But at run-time, they are actually a lot more work and a lot more code than you need. It's much simpler to just color the cells/rows inside the InitializeRow event of the grid.
Anyway, there's no way to base a tooltip on the ValueBasedAppearance directly. You could, of course, display a tooltip based on the value of the cell, which is essentially the same thing. There are a number of ways to do this. One way would be to assign a ToolTip to the grid control based on the current location of the mouse in the MouseMove or MouseDown event.To determine which cell the mouse is over, you can use UIElements. Here's an article that shows you how to do it.
HOWTO:UltraWinGrid Mouse Position and Cell Identification