title: Combobox within a listbox and a related data binding issue
body: <p>Alrighty, so I have, as I said, a ComboBox within a ListBox. These are both controls (WPF project using C# in Visual Studio 2010 and MVVM).</p>
  
  <p>I can create them all good and well. </p>
  
  <p>The ListBox contains an ObservableCollection of something called IntWrapper, which just contains and int. </p>
  
  <p>The ComboBox is loaded with an ObservableCollection of something called MissionViewModel, which is just a class that contains a few basic data types.</p>
  
  <p>So the ItemSource for the ListBox and the ComboBox are different.</p>
  
  <p>I can add and items to the ListBox with a button, which just adds a new IntWrapper to the ObservableCollection. Visually this gives me a new ComboBox, which is populated.</p>
  
  <p>What I can't figure out is how to get one of the properties of MissionViewModel to go to the property in the IntWrapper when I select it.</p>
  
  <p>Previously I just used a TextBox in the ListBox, which looked like this:</p>
  
  <pre><code>&lt;ListBox x:Name="lbMissionsToGive" ItemsSource="{Binding MissionsToGive}" SelectedItem="{Binding SelectedMissionToGive}" ContextMenu="{StaticResource RemoveMissionToGiveMenu}"&gt;
                              &lt;ListBox.ItemTemplate&gt;
                                  &lt;DataTemplate&gt;
                                      &lt;Border BorderThickness="2" BorderBrush="LightBlue" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="2" CornerRadius="5,5,5,5"&gt;
                                          &lt;StackPanel Orientation="Horizontal"&gt;
                                                      &lt;TextBlock Margin="1"&gt;Mission ID: &lt;/TextBlock&gt;
                                              &lt;TextBox Margin="1" Text="{Binding Int, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" /&gt;
                                          &lt;/StackPanel&gt;
                                      &lt;/Border&gt;
                                  &lt;/DataTemplate&gt;
                              &lt;/ListBox.ItemTemplate&gt;
                          &lt;/ListBox&gt;
  </code></pre>
  
  <p>My (non working) attempt whereby I replace the TextBox with the ComboBox is this:</p>
  
  <pre><code>&lt;ListBox x:Name="lbMissionsToGive" ItemsSource="{Binding MissionsToGive}" SelectedItem="{Binding SelectedMissionToGive}" ContextMenu="{StaticResource RemoveMissionToGiveMenu}"&gt;
                              &lt;ListBox.ItemTemplate&gt;
                                  &lt;DataTemplate&gt;
                                      &lt;Border BorderThickness="2" BorderBrush="LightBlue" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="2" CornerRadius="5,5,5,5"&gt;
                                          &lt;StackPanel Orientation="Horizontal"&gt;
                                                  &lt;ComboBox DisplayMemberPath="MissionNameAndID" SelectedValuePath="Int" ItemsSource="{Binding MissionListViewModel.MissionVMs, Source={StaticResource Locator}}"&gt;&lt;/ComboBox&gt;
                                          &lt;/StackPanel&gt;
                                      &lt;/Border&gt;
                                  &lt;/DataTemplate&gt;
                              &lt;/ListBox.ItemTemplate&gt;
                          &lt;/ListBox&gt;
  </code></pre>
  
  <p>I had thought SelectedValuePath would be the thing I wanted, but this so far doesn't seem to work (perhaps I'm using it incorrectly).</p>
  
  <p>Any assistance would be appreciated.</p>