I have a business base class (Incident) that has some attributes as well as child business base lists. After binding the Incident class to the windows form, I run into the following issue....
If someone edits one of the child lists and cancels, it sets the _bindingEdit to false even though the stateStack is not 0 and my parent object is still bound.
is there a way to change UndoChangesComplete to check if the canceledit() call isn't removing the entire stack, and avoid setting _bindingEdit to false without messing up the framework?
Brian
This was the change I made to Business Base method UndoChangesComplete, and all my tests seem to point to it working:
protected override void UndoChangesComplete(){
if (base.EditLevel < 1) //changed{ _bindingEdit =
false; }//changedValidationRules.SetTarget(
this);AddBusinessRules();
OnUnknownPropertyChanged();
base.UndoChangesComplete();}
It sems to do the trick. If someone sees something that would cause an issue, please post.
Thanks,
Brian
The reason I see it occur in my code is that I explicitly call a CancelEdit because the user is wanting to undo an insert into one of the child lists. Because of this undo, a call gets made to UndoChangesComplete, and the _bindingEdit gets set to false, and when we go back to the main screen the parent object appears to rebind, causing the stack count to jump to 2 instead of 1, and the save fails when the user hits the save button because the object is still being edited. This was the only fix I could see that appeared correct. If the stack of the base parent is at least 1, it's already been bound so I don't want any rebind by .NET to cause the edit level to change.
Would it be better to unbind and rebind the object?
Brian
Copyright (c) Marimer LLC