private void Button_Click(object sender, RoutedEventArgs e)
{
var index = Convert.ToInt16(txtBox.Text);
var view = (this.datagrid.DataContext as ViewModel).GDCSource;
var item = new Model();
view.Insert(index, item);
this.datagrid.SelectedItem = item;
var rowIndex = this.datagrid.ResolveToRowIndex(index);
this.datagrid.MoveCurrentCell(new RowColumnIndex(rowIndex, 0), true);
this.datagrid.SelectionController.CurrentCellManager.BeginEdit();
} |
private void Button_Click(object sender, RoutedEventArgs e)
{
var index = Convert.ToInt16(txtBox.Text);
var view = (this.datagrid.DataContext as ViewModel).GDCSource;
var item = new Model();
view.Insert(index, item);
this.datagrid.SelectedItem = item;
var rowIndex = this.datagrid.ResolveToRowIndex(index);
this.datagrid.MoveCurrentCell(new RowColumnIndex(rowIndex, 0), true);
this.Dispatcher.BeginInvoke(new Action(() =>
{
this.datagrid.SelectionController.CurrentCellManager.BeginEdit();
}), System.Windows.Threading.DispatcherPriority.ApplicationIdle);
}
|