MVVM and Child Objects

MVVM and Child Objects

Old forum URL:

MadGerbil posted on Wednesday, June 27, 2012

I've a form in Silverlight that shows a list of objects (BusinessListBase) in a datagrid.  When I click an edit button on the form a ChildWindow opens and displays the content of the datagrid row.   For the ChildWindow and Child Object do you use the MVVM pattern still, and if so, how?

Got any good patterns for this?

Killian35 replied on Wednesday, June 27, 2012

I use MVVM when editing a child object from a list. My view model follows the same patterns as Rocky has suggested inheriting the Csla.Xaml.ViewModel class. I pass in both the child object and the root object into the constructor. Within the view model constructor I do a BeginEdit on the root and set the VM model to the child object. I then override the Save and Cancel methods to call either ApplyEdit or CancelEdit. I bind the VM like any normal VM to the child window.


Hope this helps

MadGerbil replied on Thursday, June 28, 2012

Does the silverlight version of Project Tracker show this somewhere?  I appreciate the help and would like to see an example.

Copyright (c) Marimer LLC