Here is a snap shot for understanding

I call a function "CellEditEnding" to achieve this functionality, that is
private void dataGrid_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e)
{
TextBox t = e.EditingElement as TextBox; // Assumes columns are all TextBoxes
DataGridColumn dgc = e.Column;
DataGridRow dgr = e.Row;
Party p = new PartiesDAL().GetByPartyCode(Numerics.GetInt(t.Text));
if (dgc.DisplayIndex == 0)
{
if (p != null)
{
CashBookDetail cb = new CashBookDetail();
cb.PartyCode = p.PartyID;
cb.PartyName = p.PartyName;
cb.Remarks = "";
cb.Amount = 0;
list.Add(cb);
LoadGrid(); // list is public, add an object to list and call again LoadGrid() to load records
}
else
{
Xceed.Wpf.Toolkit.MessageBox.Show("Party does not exist", "", MessageBoxButton.OK, MessageBoxImage.Error);
}
}
}
I also want, when user on third column at "Amount", and press enter, it should add new row and focus should move on 2nd row and 1st column
This is screen shot, may it help u to understand, exactly I want this

Replies
Know the answer? Post it — somebody with the same question will find it here.