title: WPF VB.net ListBox how to get selected item index or a sorted & grouped list relative to item source
body: <p>Good evening all,</p>
  
  <p>Firstly thank you for the time taken to read this.
  I'm having some difficulty with a sorted &amp; grouped listbox in WPF vb.net 3.5 that has an items source bound to an ObservableCollection.</p>
  
  <p>What I want to be able to do is to retrieve a piece of data from the ObservableCollection items source depending on what item in the listbox the user has selected.</p>
  
  <p>I've almost got it working but because the listbox is sorted it does not match the index of the items source.</p>
  
  <p>Here is the code that I have so far:</p>
  
  <pre><code>Dim i As Integer = lstBox1.Items.IndexOf(lstBox1.SelectedItem)
  MessageBox.Show(myListSource.Item(i).Description.ToString, "Source Description")
  </code></pre>
  
  <p>As I previously mentioned, because the lstBox is sorted and also grouped the index's don't match up.</p>
  
  <p>Does anyone know how I can get the correct information I want from the List Source depending on the selected item in the list box?</p>
  
  <p>Again, thank you very much for your time,</p>
  
  <p>Rob</p>