wpf DataGridComboBoxColumn GroupStyle

422 views Asked by At

Is there anyway to set a groupstyle to DataGridComboBoxColumn any help please

thanks

2

There are 2 answers

0
Jon Mitchell On

I believe you need to set the GroupStyle for the DataGrid that contains the DataGridComboBoxColumn.

<DataGrid.GroupStyle>
    <GroupStyle>
      <GroupStyle.HeaderTemplate>
        <DataTemplate>
          <TextBlock FontWeight="Bold" FontSize="15"
                     Text="{Binding Path=Name}"/>
        </DataTemplate>
      </GroupStyle.HeaderTemplate>
    </GroupStyle>
  </DataGrid.GroupStyle>
0
Randy Wolf On

Jon's answer can be further explored here: https://social.msdn.microsoft.com/Forums/vstudio/en-US/6e463473-4cb3-486f-ac2b-c2ee2c844cf4/setting-the-group-style-for-a-datagridcomboboxcolumn?forum=wpf

I don't think this will actually produce a combobox with groups in the collection. The closest I have found is:

https://social.msdn.microsoft.com/Forums/vstudio/en-US/6edb400e-c29e-4cb9-badc-424fd4b20bef/datagrid-combobox-column-and-grouping-question-using-databinding?forum=wpf

This however is flawed too unless you want to override a lot of the functionality and be fairly meticulous about the current state of it all. I don't think there is any built in way to style a datagridcomboboxcolumn in wpf with group headers.