Datagrid row-specific tooltips

  • Thread starter Thread starter JezB
  • Start date Start date
J

JezB

Anyone know how to get a tooltip on each row of a datagrid ? The tooltip
text must be configured depending on the row that the mouse is hovering
over, and the hover timer must be reset when the user is moving the mouse
over the rows of the grid (but not necessarily moving off the grid).

No matter what I try I cannot get this to work ! Not using the grid's
tooltip property anyway, but perhaps there is a better way.
 
Hi,
I never dealed with tooltip, but I think you have to find row in
mouseHover event handler by hittest:
private void dataGrid_hover(object sender,
System.Windows.Forms.MouseEventArgs e)
{
DataGrid dataGrid = (DataGrid)sender;
Point hitPoint = new Point(e.X,e.Y);
int rowIndex = dataGrid.HitTest(hitPoint).Row;
//... change tooltip
text here depending on rowIndex
// then reset mouse
event args to be able to raise hover event again
}
to reset mouse event args you have to inherit from datagrid and call
base.ResetMouseEventArgs();
Hope it will be helpful,

Otabek
 
Back
Top