Home Forums WinForms controls Xceed Grid for WinForms Bidirectional BindingSource position change Reply To: Bidirectional BindingSource position change

User (Old forums)
Member
Post count: 23064

Sorry about the post being moved.

The grid updates correctly when the current row changes in the binding source.  The problem is that only the CurrentRow property is being updated, not the SelectedRows collection (expected behavior because these are independent properties), which means that the selection will not update in the grid.

So what you can do is to subscribe to the CurrentRowChanged event, and in the event handler, set the SelectedRows collection.

e.g.:

    private void Form1_Load( object sender, EventArgs e )
    {
      gridControl1.CurrentRowChanged += new EventHandler( gridControl1_CurrentRowChanged );
    }

    void gridControl1_CurrentRowChanged( object sender, EventArgs e )
    {
      if( gridControl1.CurrentRow != null )
      {
        gridControl1.SelectedRows.Clear();
        gridControl1.SelectedRows.Add( gridControl1.CurrentRow );
      }
    }

Imported from legacy forums. Posted by André (had 859 views)