CSLA .NET

Vibrant discussion about CSLA .NET and using the framework to build great business applications.

MVVM and Child Objects

rated by 0 users
Answered (Verified) This post has 1 verified answer | 2 Replies | 0 Followers

Top 50 Contributor
190 Posts
MadGerbil posted on Wed, Jun 27 2012 3:23 PM

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?

Answered (Verified) Verified Answer

Top 500 Contributor
24 Posts
Verified by MadGerbil

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

All Replies

Top 500 Contributor
24 Posts
Verified by MadGerbil

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

Top 50 Contributor
190 Posts

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

Page 1 of 1 (3 items) | RSS

Copyright (c) 2006-2010 Marimer LLC. All rights reserved.
Email admin@lhotka.net for support.
Powered by Community Server (Non-Commercial Edition), by Telligent Systems