title: How to Pass View Constructor Parameter to View Model
body: <p>I have a View and ViewModel.</p>
  
  <pre><code>MyView
  {
    MyView(int id)
    {
      InitializeComponent();
    }
  }
  
   MyViewModel
      {
       private int _id;
        public int ID
         {
          get { return _id; }
          set { _id= value; OnPropertyChanged("_id"); }
         }
      }
  </code></pre>
  
  <p>I am setting the data Context on my XAML as :</p>
  
  <pre><code>&lt;Window.DataContext&gt;
          &lt;vm:MyViewModel/&gt;
  &lt;/Window.DataContext&gt;
  </code></pre>
  
  <p>On Click of a button I am showing my View as :</p>
  
  <pre><code>Application.Current.Dispatcher.Invoke(() =&gt; new MyView(id).Show());
  </code></pre>
  
  <p>Now , How do I pass id from <code>MyView(id)</code> to <code>MyViewModel.ID.</code></p>