Quantcast
Channel: patterns & practices: Prism
Viewing all articles
Browse latest Browse all 1878

New Post: Prism-WPF equivalent to Silverlight's: CompositionInitializer class and SatisfyImports()

$
0
0

Hi,

Based on my understanding the view model can be instantiated in XAML as the view’s DataContext only if a view model does not have any constructor arguments. And as far as I know creating objects defined inXAML by partnering with an Inverse of Control Container is currently not supported.

Regarding the CompositionInitializer class, as far as I know there is no equivalent class forWPF, on the other hand regarding this topic, I believe you could find the following blog post interesting:

Also, I believe an alternative for this could be registering the CompositionContainerclass like mentioned in this thread:

As this could let you retrieve this class for example in your view model's constructor, in order to call theSatisfyImportsOnce method to satisfy the Imports defined in the passed class:

this.compositionContainer =ServiceLocator.Current.GetInstance<CompositionContainer>();this.compositionContainer.SatisfyImportsOnce(this);
I hope you find this handy,

Agustin Adami
http://blogs.southworks.net/aadami


Viewing all articles
Browse latest Browse all 1878

Trending Articles



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