title: WPF Style Combobox with two columns in dropdown
body: <p>I've looked around, found some things and now stuck on a combobox with two columns displayed in the drop-down area.  I have a xaml themes available and the combobox "Style" is defined and works well throughout as expected, so that part is ok.</p>
  
  <p>Now, I have a combobox that I need to have display two values, think of it as State Abbreviation and State Name for the drop-down, coming from a DataTable.DefaultView binding source for the items.  </p>
  
  <p>If I have</p>
  
  <pre><code>&lt;my:cboStates TextSearch.TextPath="StateAbbrev"&gt;
    &lt;ComboBox.ItemTemplate&gt;
      &lt;DataTemplate&gt;
        &lt;StackPanel Orientation="Horizontal" TextSearch.Text="{Binding Path=StateAbbrev}"&gt;
          &lt;TextBlock Text="{Binding Path=StateAbbrev}"/&gt;
          &lt;TextBlock Text="{Binding Path=FullStateName}" Margin="10 0"/&gt;
        &lt;/StackPanel&gt;
      &lt;/DataTemplate&gt;
    &lt;/ComboBox.ItemTemplate&gt;
  &lt;/my:cboStates&gt;
  </code></pre>
  
  <p>this works.  Now, how/where I'm stuck... Now, I want this same functionality on say 5 different forms and all to have the same content displayed, and if ever changed (not this, but for other multi-column comboboxes), I don't want to have to keep putting this directly in the form's XAML file.</p>
  
  <p>I was hoping to put into a Theme's Resource Dictionary file and just keep reusing that "style" over and over.  Makes sense.  However, when I do, and the binding is to the data table, the only results I get when trying to do as a Style is the dropdown shows values of </p>
  
  <pre><code>System.Data.DataRowView
  System.Data.DataRowView
  System.Data.DataRowView
  System.Data.DataRowView
  </code></pre>
  
  <p>instead of the actual 2 columns.
  Here is what I have in the "theme" resource dictionary.</p>
  
  <pre><code>&lt;DataTemplate x:Key="myStateComboTemplate" &gt;
    &lt;StackPanel Orientation="Horizontal"  &gt;
      &lt;TextBlock Text="{Binding Path=StateAbbrev}"/&gt;
      &lt;TextBlock Text="{Binding Path=FullStateName}"/&gt;
    &lt;/StackPanel&gt;
  &lt;/DataTemplate&gt;
  
  &lt;Style x:Key="StyleMyStatesCombobox" TargetType="{x:Type ComboBox}" 
    BasedOn="{StaticResource MyOtherWorkingComboBoxStyle}" &gt;
    &lt;Setter Property="TextSearch.TextPath" Value="{Binding Path=StateAbbrev}" /&gt;
    &lt;Setter Property="ItemTemplate" Value="{StaticResource myStateComboTemplate}" /&gt;
  &lt;/Style&gt;
  </code></pre>
  
  <p>So, If I have TWO instances my "cboStates" class created on the form, and set one to the explicit styling listed first, and the SECOND based on the "Style" setting, the second one fails by only showing the repeated System.Data.DataRowView entries, not the actual data content.</p>
  
  <p>What am I missing.</p>
  
  <p>So, to clarify what I'm looking for...
  States... ex data</p>
  
  <pre><code>AL Alabama
  AK Alaska
  AZ Arizona
  AR Arkansas
  CA California
  CO Colorado
  CT Connecticut
  DE Delaware
  </code></pre>
  
  <p>I want the combobox to be displaying the abbreviated 
  AL, AK, AZ, etc and narrower combobox.  This will ALSO be the "SelectedValue" upon return.</p>
  
  <p>The actual Dropdown would present the data as listed above showing BOTH the abbreviation AND the long description of the state.</p>
  
  <p>Sample of desired combobox</p>
  
  <p><img src="https://i.stack.imgur.com/I95YL.png" alt="enter image description here"></p>