When rows are selected in the grid that has scroll bars (vertical or horizontal), they will lose focus when scroll bar is clicked to move.
How do I keep the rows stay selected when I am done with ,or while, scrolling?
My mistake. I have some code to de-select rows in handling mouse click event.
So now the question is how do I detect that this mouse click is triggered by clicking Scroll bar, so I can ignore it so no de-select happening and the rows will stay selected. How to detect clicking on scroll bar?
You can use UIElements for this.
private void ultraGrid1_MouseClick(object sender, MouseEventArgs e) { UltraGrid grid = (UltraGrid)sender; UIElement element = grid.DisplayLayout.UIElement.LastElementEntered; if (element is ScrollBarUIElement) return; element = element.GetAncestor(typeof(ScrollBarUIElement)); if (element != null) return; }