Mvvm and Mef question

Sep 22, 2011 at 8:12 AM

Hi all ,

I have the following case on my WPF app :

I have a main user control with its MainViewModel which binded to the control datacontext . 

Inside the main control , I have an item control which item source is binded to List<User> . 

the item control has a user control as its template which draw the users details , each template as we know has User as its Datacontext .

My question : 

How I can use the Main control datacontext (MainViewModel) in the template user control . I tried to use mef to import MainViewModel but the problem its exported with creation policy "NonShared" so the import will bring new instances of the MainViewModel and not the one of the Main control .

 

Thanks in advance ...