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?
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
HI,
Just following up here.
Do you need further assistance regarding this issue.
Sincerely,
MattDeveloper Support Engineer
InitializeRow will fire any time any value of any field in the row changes. So if your tooltips are based on the values in the row, then Matt's suggestion should work.
The alternative would be to apply a Tooltip to the grid control itself, either using the inbox ToolTip class or the UltraToolTipManager. Then you have to change the tooltip based on the currently location of the mouse. The only slightly tricky part of this is determining which cell is currently under the mouse, and you can find code to do that here:
HOWTO:UltraWinGrid Mouse Position and Cell Identification
Unfortunately the proposals here do not allow for this to be done dynamically.
My predicament lies in the complexity of my implementation. Basically I have a wrappered grid control that is built dynamically based on a few tables in the DB. These tables define any number of grids within the system. With in the tables I define the properties of the grid, the columns and the column properties. There are child tables that define, the filter dropdown data, the conditional appearances, conditional security, etc.
I can basically throw an instance of my grid on to a form, set some basic properties, put data into the data base, and handle a few custom events and that is it.
So basically I am looking for a way to handle this, much like I load my ValueBasedAppearances. I currently have a function that returns a IValueAppearance based on data in the DB.
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