title: Read SelectedItem from DataBound Combobox
body: <p>I have a databound <code>ComboBox</code> that is linked to an Collection of custom objects...</p>
  
  <pre class="lang-vb prettyprint-override"><code>Public Property printerlist As New ObservableCollection(Of Printers)
  
  [..]
  Dim PrintersList = New List(Of Printers)
  
  'WMI Stuff
  Dim objMS As System.Management.ManagementScope = New System.Management.ManagementScope(ManagementPath.DefaultPath)
  
  objMS.Connect()
  
  'Query Printers
  Dim objquery As SelectQuery = New SelectQuery("SELECT * FROM Win32_Printer")
  Dim objMOS As ManagementObjectSearcher = New ManagementObjectSearcher(objMS, objquery)
  Dim objMOC As System.Management.ManagementObjectCollection = objMOS.Get()
  
          Try
              For Each Printers As ManagementObject In objMOC
                  If CBool(Printers("Local")) Then
                      PrintersList.Add(New Printers With {.DeviceName = Printers("Name"), .Type = "Local"})
                  End If
                  If CBool(Printers("Network")) Then
                      PrintersList.Add(New Printers With {.DeviceName = Printers("Name"), .Type = "Network"})
                  End If
              Next
          Catch ex As Exception
              Debug.Print(ex.Message)
          End Try
  
  Dim LCV As ListCollectionView = New ListCollectionView(PrintersList)
  Printer_Select.ItemsSource = LCV
  
  [..]
  
  Public Class Printers
      Public Property DeviceName As String
      Public Property Type As String
  End Class
  </code></pre>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;ComboBox x:Name="Printer_Select" Background="{x:Null}" Padding="4,5,4,3" BorderBrush="Gainsboro" &gt;
      &lt;ComboBox.GroupStyle&gt;
          &lt;GroupStyle&gt;
              &lt;GroupStyle.HeaderTemplate&gt;
                  &lt;DataTemplate&gt;
                      &lt;TextBlock Text="{Binding Name}" FontWeight="Bold" FontSize="11" FontFamily="Segoe UI Semibold"/&gt;
                  &lt;/DataTemplate&gt;
              &lt;/GroupStyle.HeaderTemplate&gt;
          &lt;/GroupStyle&gt;
      &lt;/ComboBox.GroupStyle&gt;
      &lt;ComboBox.ItemTemplate&gt;
          &lt;DataTemplate&gt;
              &lt;TextBlock Text="{Binding DeviceName}"/&gt;
          &lt;/DataTemplate&gt;
      &lt;/ComboBox.ItemTemplate&gt;
  &lt;/ComboBox&gt;
  </code></pre>
  
  <p>When I try to retrieve the <code>SelectedItem</code> of the <code>ComboBox</code> 'Printer_Select', I either get the name of the element or the error 'Conversion from type 'Printers' to type 'String' is not valid.'</p>
  
  <p>How do I get the <code>DeviceName</code> of the <code>ComboBoxItem</code> when it's selected in the dropdown?</p>