title: Passing Parameters between xaml window and usercontrol WPF
body: <p>How to pass Parameters from xaml window to WPF usercontrol constructor?
  I have tried creating dependency property, but it fails to do it. 
  Should I try xaml extensions or is there any other way to do it?   </p>
  
  <pre><code>&lt;local:Myusercontrol Param1="user1"/&gt;
  </code></pre>
  
  <p>xaml.cs of the calling <code>Window</code>, well its usercontrol.</p>
  
  <pre><code>public partial class SomeView : UserControl
  {
      SomeViewModel vm = new SomeViewModel();
      public SomeView()
      {
          this.DataContext = vm;
          InitializeComponent;
      }
  }
  </code></pre>
  
  <p><code>InitializeComponent</code> of above window clears value of dependency property set through xaml before creating an instance of the user control and hence value of depencency property is always null.</p>
  
  <p>and usercontrol's xaml.cs</p>
  
  <pre><code>Myusercontrol : UserControl
  {
    public Myusercontrol (string User)
    {
      InitializeComponent();
      UserControlViewModel vm = new UserControlViewModel (User);
      this.DataContext = vm;
    }
  </code></pre>
  
  <p>Note that I am using MVVM pattern.</p>