What all can be, if call of Model.CancelEdit() Doesn't Work ?
The Model IsDirty and e.g. Save can Execute.
It's a WPF Application with MVVM (own ViewModelBase).
The call of Model.CancelEdit() runs, but no changed Property are reset to the original value.
It's a Parent Model with Csla Propertys and Csla ChildLists Propertys.
Are you sure BeginEdit has been called first to create an initial snapshot?
Check Model.EditLevel - it should be > 0 before you call CancelEdit
Hello Jonny,
Yes, this did the trick, i have to call first, after Loading the Model, the Model.BeginEdit() function to get an Snapshot.
I thought it was automaticaly called, but it didn't.
Rockys Post http://forums.lhotka.net/forums/p/6861/32872.aspx#32872 explained it.
But, to get Model.EditLevel (Using CSLA 4.5.30) i have to cast it to Csla.Core.IUndoableObject
Is that right ?
I would use it in the Undo Command Button CanExecute to examine if the Undo Button is On or Off.
Hi,
I think BeginEdit is only called if the ViewModel has ManageLifeTime = true.
Yes this is correct. You need to cast the object IUndoableObject.
Copyright (c) Marimer LLC