title: passing data from one Window to another
body: <p>I have 2 windows. When I press a button, I want to pass a <code>Person</code> object from current <code>Window</code> to the other one.</p>
  
  <p>This is the code in the main window:</p>
  
  <pre><code>private void Button_Click(object sender, RoutedEventArgs e)
  {
      person owner = new person();
      owner.ID = 1;
      owner.Name = "Mark";
      w2 newWindow = new w2(owner);
  
      newWindow.Show();
  }
  </code></pre>
  
  <p>In the other window named <code>w2</code> I have this code:</p>
  
  <pre><code>public partial class w2 : Window
  {
      public class person
      {
          int _ID;
          string _Name;
  
          public int ID
          {
              get { return _ID; }
              set { _ID = value; }
          }
          public string Name
          {
              get { return _Name; }
              set { _Name = value; }
          }
     }
  
     public w2()
     {
         InitializeComponent();
     }
  
     public w2(person passedPerson) : this()
     { 
         this.passedPerson = passedPerson;
     }
  }
  </code></pre>
  
  <p>I get these errors when I try to compile:</p>
  
  <blockquote>
    <p>Error 3   'passing.w2' does not contain a definition for 'passedPerson' and no extension method 'passedPerson' accepting a first argument of type 'passing.w2' could be found (are you missing a using directive or an assembly reference?    48  18  passing</p>
    
    <p>Error 1   The best overloaded method match for 'passing.w2.w2(passing.w2.person)' has some invalid arguments  57  28  passing</p>
    
    <p>Error 2   Argument 1: cannot convert from 'passing.MainWindow.person' to 'passing.w2.person'      57  35  passing</p>
  </blockquote>
  
  <p>BTW. I've using this example as a starting point:</p>
  
  <p><a href="http://go4answers.webhost4life.com/Example/pass-variables-windowopen-wpf-31068.aspx" rel="nofollow">http://go4answers.webhost4life.com/Example/pass-variables-windowopen-wpf-31068.aspx</a></p>