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

New Post: Getting container in View Model

$
0
0
I have a view that defines a view model in xaml:
<UserControl.DataContext>
        <VM:MainMenuViewModel />
    </UserControl.DataContext>ext>
Then my VM:
   public class MainMenuViewModel
    { 
        private readonly IUnityContainer container;

        public MainMenuViewModel(IUnityContainer _container)
        {
            container = _container; 
        }
.......
I get an error saying that no accessible constructor exists when the view runs because it isn't injecting the IUnityContainer. What is the "proper" way to access the container from a view model? Thanks.

Viewing all articles
Browse latest Browse all 1878

Trending Articles



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