title: WPF and Unity - No matching constructor found on type
body: <p>I want to use Unity in my WPF application using VS2012, I defined unity container as follows:</p>
  
  <pre><code>IUnityContainer unityContainer = new UnityContainer();
  unityContainer.RegisterType&lt;IMainViewModel, MainViewModel&gt;();
  var window = unityContainer.Resolve&lt;MainWindow&gt;();
  window.Show();
  </code></pre>
  
  <p>My window constructor looks as follows:</p>
  
  <pre><code>public MainWindow(IMainViewModel mainViewModel)
         {
              InitializeComponent();
              this.DataContext = mainViewModel;
          }
  </code></pre>
  
  <p>When I run the application I get the following error:</p>
  
  <blockquote>
    <p>An unhandled exception of type
    'System.Windows.Markup.XamlParseException' occurred in
    PresentationFramework.dll</p>
    
    <p>Additional information: 'No matching constructor found on type
    'WPFClient.MainWindow'. You can use the Arguments or FactoryMethod
    directives to construct this type.' Line number '3' and line position
    '9'.</p>
  </blockquote>
  
  <p>What am I doing wrong?</p>