views:

114

answers:

2

Hi, I am using mvvm architecture view first approach in my project. I mean I have view-viewmodel binding defined in resource file. But i'm unable to open multiple instances of same view...If I open the the new viewmodel will refer to the first view.

A: 

Try setting

x:Shared="false"

Read more here

rudigrobler
But Is this x:shared only available in frame work 4.0 ?
Anish
No, its always been their! AFIK
rudigrobler
i am unable to find it..:)
Anish
A: 

WPF initializes data templates as singletons by default. You can override this behavior by using the x:Shared=false setting. Note: This works only with compiled resource files.

A more flexible option is to use an IoC Container for creating the associated View for a ViewModel. You might have a look at the WPF Application Framework (WAF) which shows how this works by using the Managed Extensibility Framework (MEF) as an IoC Container.

jbe