Fins specific cell in bound datagrid?

Oct 26, 2009 at 10:29 AM

Hello,

I have a datagrid that is bound to an observerable collection. When I add a new element to the list I'd like to select the new row in the datagrid and set focus in one of it's cells.

I can find the new row in the observablecollection (a new row has id=0) but how can I find that row in the datagrid??

The datagrid can be sorted in various ways by pressing the headers.

Oct 29, 2009 at 3:41 PM

I've managed to select the new row but can't get it to start the editing in my column, any ideas?

"topic" is my new row and "dgTopics" is my DataGrid.

 

var topic = new Topic();

dgTopics.Focus();
dgTopics.SelectedItem = topic;
dgTopics.CurrentColumn = dgTopics.Columns[1];
dgTopics.UpdateLayout();
dgTopics.ScrollIntoView(dgTopics.SelectedItem, this.dgTopics.Columns[1]);
dgTopics.BeginEdit();