This project has moved and is read-only. For the latest updates, please go here.

Blendability for Edit ViewModel

Nov 30, 2010 at 1:00 PM


This post is based on blendability example showed in Mix10.

For list viewModel everything is allright because in constructor it calls IDataService.

Option1: create EditViewModel by Entity. Create EditView(), set it's DataContext to Entity, show View. At run time it works, but no blendability as DataContext (Entity) is set explicitily.

Option2: create EditViewModel by Id. It would use IDataService, so blendability would work, but no way to pass Id to ViewModel as I create instance of View. Also loaded Entity would be different instance from that in list, so no auto-refresh.

I couldnt find any examples, because all of them illustrates MVVM only for list ViewModel, no details, edit.

So, how should EditViewModel be implemented by MVVM with blendability support? (sharing entity instance from list would be nice => grid auto-refresh)