0

To take advantage of DevExpress Winforms XtraGrid incremental search, the user must first click on a row before typing.

How to set focus on the first row programmatically, to avoid that step?

In the control's DataSourceChanged event, I've tried setting focus to the control itself

       gridControl1.Focus();

or to its default view

      gridControl1.DefaultView.Focus();

but neither had the desired effect.

Also have tried setting the FocusedRowHandle:

        gridControl1.DataSource = T;
        this.gridView1.FocusedRowHandle = 0;
Tim
  • 8,669
  • 31
  • 105
  • 183

1 Answers1

4

Try this:

private void gridControl1_DataSourceChanged(object sender, EventArgs e)
{
  this.ActiveControl = this.gridControl1;
  this.gridView1.FocusedRowHandle = 0;
}
Marko Juvančič
  • 5,792
  • 1
  • 25
  • 41