Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
430
How to activate and commit "Add new row" programmatically?
posted

Hello!

In my application, I'm using xamGrid and I need the Add New Item row to appear when a button is clicked and be instantly editable. I didn't find a proper way to activate the row editor on the Add New Item row, so I used to following hack:

 

xamGrid.AddNewRowSettings.AllowAddNewRow =
 AddNewRowLocation.Top; xamGrid.UpdateLayout(); var newRowCheckboxCell =
 Infragistics.Windows.Utilities.GetDescendantFromType(
xamGrid,
typeof(AddNewRowCellControl),
true);
var cellToEdit = (newRowCheckboxCell as AddNewRowCellControl)
.Cell.Row.Cells[1];
xamGrid.EnterEditMode(cellToEdit);

 

However, when I finish editing the row (either pressing Enter or clicking outside the row), the row is not added and the RowAdded event does not fire. I must enter and exit the edit mode manually once more time for the row to be added. Why is this happening and how can this be worked around?