I am trying to do some simple thing in WPF but can't find the way to do it.
I have a ComboBox in a DataGrid header to filter data. The data is binded to a GrouBy statement of all my data.
These show some CheckBox The XAML code is:
<DataGridTextColumn x:Name="Type"
Binding="{Binding TypeOfData, Mode=OneTime}"
SortMemberPath="TypeOfData"
IsReadOnly="true"
CanUserSort="true">
<DataGridTextColumn.Header>
<DockPanel>
<Label Content="Type Of Data"
DockPanel.Dock="Left"/>
<ComboBox x:Name="comboBoxType"
DockPanel.Dock="Right"
SelectionChanged="comboBoxType_SelectionChanged">
<ComboBox.ItemTemplate>
<DataTemplate>
<StackPanel x:Name="itemsComboBox">
<CheckBox Name="checkBoxType"
IsChecked="False"
Content="{Binding Key}"
Unchecked="FilterChange"
Checked="FilterChange"/>
</StackPanel>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
</DockPanel>
</DataGridTextColumn.Header>
</DataGridTextColumn>
The code behind fore binding is:
comboBoxType.ItemsSource = allData.GroupBy(data=> data.TypeOfData).OrderBy(grp=> grp.Key);
And this work.
But now I want to add 2 button to check and uncheck all at the end or at the start of the ComboBox but I can't seem to find how to add those static button in a dynamic data template.
Edit Answer to grek40: I want the buttons in the combobox Items before or after the checkboxes.
CompositeCollection could help but I can't seem to make it work.
Thank You