It seems you can also get this information from the items view, namely this works:
IEditableCollectionView itemsView = stateGrid.Items;
if (itemsView.IsAddingNew || itemsView.IsEditingItem)
{
stateGrid.CommitEdit(DataGridEditingUnit.Row, true);
}
I have not confirmed this but most likely you could get these flags in a viewmodel if your bound collection provides an IEditableCollectionView.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…