On each DataGridColumnHeader I have a button that I use to open a popup. As a parameter it sends the column's bound Property name to the ICommand in my ViewModel.
This works well for any DataGridTextColumn however when it comes to a DataGridComboBoxColumn the structure is different.
How would I solve this?
<Button Command="{Binding DataContext.OpenFilterCommand,
RelativeSource={RelativeSource AncestorType=UserControl}}"
CommandParameter="{Binding Column.Binding.Path.Path,
RelativeSource={RelativeSource Mode=TemplatedParent}}"/>
Problem Column Definition
<DataGridComboBoxColumn Header="Company" >
<DataGridComboBoxColumn.ElementStyle>
<Style TargetType="ComboBox">
<Setter Property="ItemsSource" Value="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type DataGrid}}, Path=DataContext.CompanyCollection}"/>
<Setter Property="IsReadOnly" Value="True"/>
<Setter Property="SelectedValue" Value="{Binding Company}"/>
</Style>
</DataGridComboBoxColumn.ElementStyle>
<DataGridComboBoxColumn.EditingElementStyle>
<Style TargetType="ComboBox">
<Setter Property="ItemsSource" Value="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type DataGrid}}, Path=DataContext.CompanyCollection}"/>
<Setter Property="SelectedValue" Value="{Binding Company}"/>
</Style>
</DataGridComboBoxColumn.EditingElementStyle>
</DataGridComboBoxColumn>