title: WPF Send combox's selected value to another window's identical combobox
body: <p>I have a window at startup where you select an Interface and Port from 2 comboboxs. When you click Done, it takes you to the main window, where you can see 2 more comboxes that are identical. These have the selected values as what you just picked in the popup window. Can I do this in the code behind? </p>
  
  <p>Here's my popup window, <code>winResetInterface.xaml</code>:</p>
  
  <pre><code>Window x:Class="simpliphy.winResetInterface"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      Title="winResetInterface" Height="280" Width="259"&gt;
  &lt;Grid Margin="0,-1,2,1"&gt;
      &lt;ComboBox Name="cmbInterface" ItemsSource="{Binding Interface}" DisplayMemberPath="Name" HorizontalAlignment="Left" Margin="94,52,0,0" VerticalAlignment="Top" Width="91"/&gt;
      &lt;Button x:Name="btnFinishSetup" Click="btnFinishSetup_Click" Content="Done" HorizontalAlignment="Left" Margin="76,173,0,0" VerticalAlignment="Top" Width="75"/&gt;
     &lt;ComboBox x:Name="cmbPort"  ItemsSource="{Binding SelectedItem.Port, ElementName=cmbInterface}" HorizontalAlignment="Left" Margin="94,88,0,0" VerticalAlignment="Top" Width="91"/&gt;
  &lt;/Grid&gt;
  </code></pre>
  
  <p></p>
  
  <p>And in my code behind:</p>
  
  <pre><code>     namespace project
      {
  
          public partial class winResetInterface : Window
          {
              public ObservableCollection&lt;Model.Device_Class&gt; Interface { get; set; }
  
                  public winResetInterface()
                  {
                     InitializeComponent();
                     DataContext = this;
                     Interface = new ObservableCollection&lt;Model.Device_Class&gt;();
                     Interface.Add(new Device_Class() { Name = "XGBE", Port = new ObservableCollection&lt;string&gt;() { "0" } });
                     Interface.Add(new Device_Class() { Name = "SATA0", Port = new ObservableCollection&lt;string&gt;() { "0", "1", "2", "3" } });
                   }
            }
  
          private void btnFinishSetup_Click(object sender, RoutedEventArgs e)
          {
              MainWindow main = new MainWindow();
              App.Current.MainWindow = main;
              this.Close();
              main.Show();
  
              //Set the selected options on the device stats sidebar
              ///THIS IS WHERE I'M STUCK!
              main.cmbInterface_main.SelectedItem = cmbInterface.SelectedItem;
  
  
          }
      }
  </code></pre>
  
  <p>In my MainWindow, I have a combobox that is filled the same way as box1, cmbInterface. Can I not just set the 2 selecteditems equal to each other?</p>