title: Binding for ComboBox Header in DataGrid
body: <p>I have a DataGrid in a WPF MVVM pattern application, and I am trying to use a combo box in the header to filter the grid.  I can do this when all of the code is in the Window class (not MVVM) but for my own sake I am trying to bind it to the VM to get the same results.  Here's the XAML:</p>
  
  <pre><code>&lt;DataGridTextColumn x:Name="transNameColumn" Binding="{Binding TransName}" Width="325"&gt;
  &lt;DataGridTextColumn.Header&gt;
      &lt;ComboBox ItemsSource="{Binding oTran}" DisplayMemberPath="TransName" SelectedValuePath="UID"
              HorizontalAlignment="Left" Width="315"&gt;
          &lt;i:Interaction.Triggers&gt;
              &lt;i:EventTrigger EventName="SelectionChanged"&gt;
                  &lt;i:InvokeCommandAction Command="{Binding Transmittal_ComboSelect}"/&gt;
              &lt;/i:EventTrigger&gt;
          &lt;/i:Interaction.Triggers&gt;
      &lt;/ComboBox&gt;
  &lt;/DataGridTextColumn.Header&gt;
  </code></pre>
  
  <p></p>
  
  <p>The DataGrid in which this resides looks like this (just the top where the binding is):</p>
  
  <pre><code>&lt;DataGridTextColumn x:Name="transNameColumn" Binding="{Binding TransName}" Width="325"&gt;
  &lt;DataGridTextColumn.Header&gt;
      &lt;ComboBox ItemsSource="{Binding oTran}" DisplayMemberPath="TransName" SelectedValuePath="UID"
              HorizontalAlignment="Left" Width="315"&gt;
          &lt;i:Interaction.Triggers&gt;
              &lt;i:EventTrigger EventName="SelectionChanged"&gt;
                  &lt;i:InvokeCommandAction Command="{Binding Transmittal_ComboSelect}"/&gt;
              &lt;/i:EventTrigger&gt;
          &lt;/i:Interaction.Triggers&gt;
      &lt;/ComboBox&gt;
  &lt;/DataGridTextColumn.Header&gt;
  </code></pre>
  
  <p></p>
  
  <p>and the top level grid is bound thusly:</p>
  
  <pre><code>&lt;Grid DataContext="{Binding}"&gt;
  </code></pre>
  
  <p>I am thinking that because the combo box is inside the datagrid the binding gets messed up.  When I have the combo box on its own, with the same XAML it works fine.  But when inserted as the header it does not populate (and I think the event binding will also not work, but can't verify as it does not populate so there's no way to make a selection).</p>