Hi, we recently struck an interesting issue.
We had already had a model, vm & view (Purchase) for an app.
Then we neede to add a new concept (PurchaseOrder) which contained another new concept (PurchaseOrderItem). The PurchaseOrderItem model contained a Purchase model.
No problems (we thought), we just created vms & views for the new models. The PurchaseOrderItem view just included the Purchase view (binding it to the Purchase model within the PurchaseOrderItem).
The PurchaseOrder view included a list of PurchaseOrderItems & a 'detail area' displaying the selected item (in a PurchaseOrderItem view, which contained a PurchaseView).
This is when we noticed problems.
If we edited one item in the list & selected another item before saving the changes, the edited item 'magically' reverted back to its 'original' state. Similar result when adding new items. IE we had to save the PurchaseOrder before adding another
Note: our models are complex objects (CSLA BusinessBase) which handle db interaction & distributed execution (eg WCF) issues.
After debugging this for a while we realised that each View was firing begin & cancel directly on the relevant models when the selected item was changed. In simple models this had not caused us any noticable issues.
We hav now 'fixed' the issue by using a 'standard' (ie non catel) UserControl to hold the UI objects. The views (Catel) now just include the usercontrol. IE no view includes another view.
EG, in our case we now have:
- Purchase user control containing the actual UI objects
- Purchase view (Catel) which contains the Purchase user control
- PurchaseOrderItem view (Catel) which includes the Purchase user control