Injecting existing VM instance in other VM constructor

Nov 29, 2011 at 10:43 AM

Hi, I'm having trouble using MefedMVVM in scenarios where I have some items view/viewmodel and Add/Edit item command. Both commands open new window (view and corresponding viewmodel). With edit I want to inject currently selected item from items viewmodel to item viewmodel. How is this possible with MefedMVVM? I can do this "by hand", but the code feels dirty. 

Any help or perhaps a small example would be greatly appreciated.

Coordinator
Nov 30, 2011 at 7:02 AM

I would suggest this

http://marlongrech.wordpress.com/2011/08/27/mefedmvvm-navigationextension/

Nov 30, 2011 at 9:54 AM

Hi,

thanks for quick reply. I read the text you suggested an I must say, that I could use it. There is one thing though. It seems to me that NavigationHost can't be Window, or am I missing something. If that is the case, I should forget about dialog windows implementation and use some content control instead or find some other way around this.

Anyway, thanks

Coordinator
Nov 30, 2011 at 10:08 AM
Ideally it would be a ContentControl. You can do other ControlHost (as I explain in the article) but a window is a bit problematic since you cannot get a reference for it in XAML... Maybe its something I should look into in future

Regards
Marlon
WPF Blog - http://marlongrech.wordpress.com/
MEFedMVVM - http://mefedmvvm.codeplex.com


On Wed, Nov 30, 2011 at 11:54 AM, TineSvete <notifications@codeplex.com> wrote:

From: TineSvete

Hi,

thanks for quick reply. I read the text you suggested an I must say, that I could use it. There is one thing though. It seems to me that NavigationHost can't be Window, or am I missing something. If that is the case, I should forget about dialog windows implementation and use some content control instead or find some other way around this.

Anyway, thanks

Read the full discussion online.

To add a post to this discussion, reply to this email (MEFedMVVM@discussions.codeplex.com)

To start a new discussion for this project, email MEFedMVVM@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com


Nov 30, 2011 at 10:15 AM

I will go with the ContentControl host and see where does it take me.

Thank you for your time and I appreciate the work you put into MefedMVVM. It's really cool.

Regards, Tine