Quantcast
Channel: Managed Extensibility Framework
Viewing all articles
Browse latest Browse all 265

New Post: MEF loading multiple instances of my MVVM Modules

$
0
0
Hi Nick,

I'm using the version that comes with .Net 4.5, but I solved my problem this morning!

The problem was that in my View the Xaml I was assigning the DataContext - so when my view model was loaded, it loaded the View which then loaded another instance of the ViewModel to attach to the view! consequentially I ended up with two ViewModels which was causing my problems with the INotifyPropertyChanged events.

The solution was to remove the DataContext from the xaml and in the code behind have
[import]
public myViewModel context
{
set
{
this.DataContext = value;
}
}
and that worked!!

Viewing all articles
Browse latest Browse all 265

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>