Hi,
I want to select/highlight the entire row on which the mouse is over in the ultragrid. How is that done?
thanks.
..ab
I just wanted to know if you were able to solve your issue based on Mike's suggestions or you still need help? Just let me know.
Thank you.
private void ultraGrid1_MouseDown(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Right) { UltraGrid grid = (UltraGrid)sender; UltraGridRow row = this.GetRowMouseIsCurrentlyOver(grid); if (row != null) { row.Activate(); row.Selected = true; } } } private UltraGridRow GetRowMouseIsCurrentlyOver(UltraGrid grid) { UIElement element = grid.DisplayLayout.UIElement.LastElementEntered; if (element == null) return null; UIElement rowUIElement = element as RowUIElement; if (rowUIElement == null) rowUIElement = element.GetAncestor(typeof(RowUIElement)); if (rowUIElement == null) return null; UltraGridRow row = rowUIElement.GetContext(typeof(UltraGridRow)) as UltraGridRow; return row; }
Thanks for the answer. Sometimes the user just right clicks on any row, and that row doesnt get selected. I want the row to first get selected on which the mouse was when the right-click happened.
Note that selecting and highlighting are separate concepts and selecting a row on a mouse hover would probably not be a good idea from the user's perspective, so I assume you just want to change the visual appearance of the row on a mouse hover. You can do this by setting properties on the UltraGrid.DisplayLayout.Override.HotTrackRowAppearance, such as BackColor.