Databinding part 2

Databinding part 2

Old forum URL: forums.lhotka.net/forums/t/3085.aspx


ajj3085 posted on Monday, June 25, 2007

Hi,

Thanks to Rocky's help, I've gotten my databinding code corrected, except for one issue.

The problem I'm now encountering is this:  I have a root object, which a child collection.  The root object is a document, say a Quote, and the collection are of LineItems.  Everything is working nicely, until I try one of the features which is Group of line items.  Certain line items may contain other line items. 

To handle the grouping requirement, I have a GroupLineItem object, which contains a GroupSubItems collection.  A GroupSubItem is a decorator around the original line item.  When the grouping is done, the items currently in the documents LineItems collection are removed, a GroupLineItem is created and the items removed are placed into the GroupSubItems of the new GroupItem.

Initially I hit a problem because the new group line item never had BeginEdit called on it.  I ensured this happened, and also marked the GroupSubItems collection as NotUndoable.  This seems to work for creating a group.

The problem now is editing of the group item or one if its subitems is causing an Edit level mismatch UndoException.  I'm kind of at a loss on how to proceed in this case.

Any suggestions?

ajj3085 replied on Tuesday, June 26, 2007

I think I solved the issues here.  In the GroupSubItem, I marked the decorated instance field as NotUndoable.  I also removed the manual call to BeginEdit on the GroupItem before added it to the collection, which I do via the Items binding source.  Everything seems pretty happy now..

Copyright (c) Marimer LLC