MVVM light- Pass data to nested views

Mar 3, 2011 at 3:30 PM


I have 2 nested views. CustomerView has OrderView as a child view.   Both views needs to show data at the same time.

I am using ViewModelLocator to assign CustomerViewModel and OrderViewModel to resp Views.

CustomerViewModel fetches data in the constructor. Properties of CustomerViewModel are bound to CustomerView.

Nested OrderView should get data from CustomerViewModel.OrderViewModel.

The data is not shown on OrderView

How can I assign CustomerViewModel.OrderViewModel as a DataContext of nested OrderView, so that the data is displayed in both views at the same time.?

I guess ViewModelLocator is not a proper way in case of OrderView.

Please help.

-If you need some code then I can send it via email.