title: Getting Selected Item with composite collection in wpf
body: <p>I am trying to set itemsSource of a listbox to a compositecollection.</p>
  
  <pre><code>&lt;ListBox x:Name="moduleMenu" SelectedItem="{Binding SelectedSourceViewDetail}"&gt;
                          &lt;ItemsControl.ItemsPanel&gt;
                              &lt;ItemsPanelTemplate&gt;
                                  &lt;StackPanel Orientation="Horizontal"/&gt;
                              &lt;/ItemsPanelTemplate&gt;
                          &lt;/ItemsControl.ItemsPanel&gt;
  
                          &lt;ListBox.ItemsSource&gt;
                              &lt;CompositeCollection&gt;
                                  &lt;ListBoxItem DataContext="{Binding SourceModule.Settings}" Content="{Binding Name}"/&gt;
                                  &lt;CollectionContainer Collection="{Binding SourceModule.ExtraViews}" /&gt;
                              &lt;/CompositeCollection&gt;
                          &lt;/ListBox.ItemsSource&gt;
                      &lt;/ListBox&gt;
  </code></pre>
  
  <p>However the binding with selectedItem is not working. How can I get the selected item in viewmodel when an item gets selected?</p>