title: C# .xaml transfer an Object from one window another
body: <p>I have a form &quot;SprocketOrderForm.xaml&quot; window.  I push a button to open a new window, &quot;SprocketForm.xaml&quot;.  In that window when I click submit it will create a new &quot;Aluminum&quot; object populated by the textboxes in &quot;SprocketForm&quot;.  Now I need to get that new object back into a listbox in &quot;SprocketOrderForm&quot;.  I've been stuck on this for a while now.</p>
  <pre><code>&quot;SprocketOrderForm.xaml&quot;
      private void btnAdd_Click(object sender, RoutedEventArgs e)
          {
              if (rbAluminum.IsChecked==true)
              {
                  SprocketForm sf = new SprocketForm(&quot;Aluminum&quot;);
                  sf.Show();
                  lisbOrderList.Items.Add(sf.objAlum);
              }
          }
      
  
  
      &quot;SprocketForm.xaml&quot;
      
          private void btnSubmit_Click(object sender, RoutedEventArgs e)
                      {
                          if (sproc==&quot;Aluminum&quot;)
                          {
                              AluminumSprocket Steel = new AluminumSprocket(int.Parse(txtbItemID.Text), int.Parse(txtbNumberOfItems.Text), int.Parse(txtbNumberOfTeeth.Text));
                              objAlum = Steel;
                              this.Close();
                          }
                      }
  </code></pre>