WPF DataGrid - Set a cell into edit mode programmatically

datagrid, wpf

Solution

Assuming WPF:

<DataGrid x:Name="dg".... />

Then this code will work:

dg.CurrentCell = new DataGridCellInfo(dg.Items[i], dg.Columns[j]);
dg.BeginEdit();

Problem

I have a WPF DataGrid that shows some data records (bounded to an ObservableCollection). When the user clicks "Edit" button, the currend selected row should move into edit-mode (As if the user double-clicked this row). How do I do that?

Original source

Related problems