I have a wingrid placed inside a panel control. I allow the user to drag/drop an item from my listbox control into the grid control which resides in a panel control. How do I highlight the row that the user is currently hovering over until the user drops the item?
My panel.Drag events get fired instead of the grid's. I managed to get the row highlighted in the grid using the following:
Dim uieOver As UIElement = _healthIssueGrid.grdHealthIssue.DisplayLayout.UIElement.ElementFromPoint(_healthIssueGrid.grdHealthIssue.PointToClient(New System.Drawing.Point(e.X, e.Y)))
If uieOver IsNot Nothing Then
DIm ugrOver as UltraGridRow = TryCast(uieOver.GetContext(GetType(Infragistics.Win.UltraWinGrid.UltraGridRow), True), Infragistics.Win.UltraWinGrid.UltraGridRow)
If ugrOver IsNot Nothing Then
ugrOver.Appearance.BackColor = Drawing.Color.Yellow
End If
End Sub
But I can not manage to unhighlight the row once the user moves the mouse over a different row.
Any suggestions would be appreciated.
Dave K.
Thank you for your suggestion. I already tried to do exactly that in the pnlGrid_DragOver event. Once the code to reset the appearance is run, the rest of the code in the dragOver event didn't fire.
Since you suggested the same technique, I coded it up again and found my error. I needed to check that ugrOver was not Nothing before resetting the backColor or the rest of the code does not execute.
Thanks again!
Dave
What you will probably need to do is store the row that you applied the color to in a form-level variable. Then you can just call ugrOver.Appearance.Reset to clear the highlighting.