Per a suggestion in the forum (http://www.syncfusion.com/support/Forums/message.aspx?MessageID=16469)
I''m handling the CurrentCellMoved event, and calling RefreshRange() and then in QueryCellInfo setting colors to highlight the current row and column of the selected cell.
I have set ActivateCurrentCellBehavior = GridCellActivateAction.SelectAll to select the text in a cell when the user moves into the cell. However, when calling RefreshRange() in the CurrentCellMoved event, I''m losing that selected text.
What is the best way to get the selected text to remain after the RefreshRange() calls?
I have poked around a bit, and realized that I could get at the RichTextBox control in the cell, then set the SelectedLength property.
RichTextBox tb = grid1.CurrentCell.Renderer.Control as RichTextBox;
if ( tb != null )
int len = tb.Text.Length;
tb.SelectionLength = len;
Any thoughts about this method, or any better ways to achieve this?
(I do see a slight flicker in the selection doing it this way...text in the newly selected cell is selected, then not, then selected again)
You could try turning off the ActivateCurrentCellBehavior = SelectAll, and do the SelectAll yourself at the bottom of your CurrentCellMoved with the code below. Hopefully, this would avoid the flicker you mentioned.
GridCurrentCell cc = this.gridControl1.CurrentCell;
GridTextBoxControl tb = cc.Renderer.Control as GridTextBoxControl;
if(tb != null)