User (Old forums)MemberJanuary 19, 2008 at 12:48 amPost count: 23064
I have a grid set up with InactiveSelectionBackColor and InactiveSelectionForeColor set to the same values as SelectionBackColor and SelectionForeColor, respectively. I also have AllowCellNavigation set to false.
This gives me the desired effect I want, that is, the grid shows the selected row in the same colors whether or not is has focus, and the entire row is always highlighted.
When the grid has focus:
Up-Arrow = select the previous row.
Down-Arrow = select the next row.
Page-Up = moves up a page
Page-Down = moves down a page
Ctrl-Page-Up = moves to the first row
Ctrl-Page-Down = moves to the last row
I want to be able to make all these moves by calling grid methods when some other control has focus. How can I do this???
PS: I can use MoveCurrentRow(), and the current row changes, but the highlight doesn’t redraw until the grid gets focus and you press one of the above keys.
Imported from legacy forums. Posted by Glenn (had 3887 views)User (Old forums)MemberJanuary 19, 2008 at 1:25 amPost count: 23064
Figured out how to do this myself:
Imported from legacy forums. Posted by Glenn (had 2981 views)User (Old forums)MemberApril 3, 2009 at 8:27 amPost count: 23064
If you still haven’t found the solution for mentioned problem here it is…
After calling MoveCurrentRow, current row is changed, but it still has to be selected:
this.gridControl1.CurrentView.IsSelected = true;
This in the other hand causes previous row to remain selected, so before MoveCurrentRow call, be sure to deselect currently selected row(s):
At the end I would also recommend to call BringIntoView method, which will bring newly selected row into visible part of the grid (important on page up, page down features).
protected void MoveRowCurrentRowSelection(VerticalDirection direction)
if (gridControl1.CurrentRow != null)
this.gridControl1.CurrentRow.IsSelected = true;
Imported from legacy forums. Posted by Ogren (had 2629 views)
- You must be logged in to reply to this topic.