I have a ListView containing several GridViewColumns. Several of the columns are checkboxes. Each column header consists of a checkbox as well, with the intention of checking/unchecking all the checkboxes in that column. Each row's checkboxes are bound to properties in my view model. I've seen several postings where the scenario is a single column of checkboxes, but none of those solutions will work for me, as I have 4 columns of checkboxes. I also need to persist the state of the selections from one visit to the next (all, some or none of the checkboxes in a column could be checked).
Here's an abbreviated version of the XAML for my ListView:
<ListView ItemsSource="{Binding AveragingParameters}">
<ListView.View>
<GridView AllowsColumnReorder="False">
<GridViewColumn Header="Parameter">
<GridViewColumn.CellTemplate>
<DataTemplate>
<DockPanel>
<TextBlock Text="{Binding Name}" />
</DockPanel>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn>
<GridViewColumn.CellTemplate>
<DataTemplate>
<Grid HorizontalAlignment="Stretch">
<CheckBox x:Name="chkAvg" IsChecked="{Binding CalcAverage}" />
</Grid>
</DataTemplate>
</GridViewColumn.CellTemplate>
<Grid>
<CheckBox x:Name="chkAvgSelectAll" Content="Avg" ToolTip="Select All" />
</Grid>
</GridViewColumn>
<GridViewColumn>
<GridViewColumn.CellTemplate>
<DataTemplate>
<Grid HorizontalAlignment="Stretch">
<CheckBox x:Name="chkMin" IsChecked="{Binding CalMin}" />
</Grid>
</DataTemplate>
</GridViewColumn.CellTemplate>
<Grid>
<CheckBox x:Name="chkMinSelectAll" Content="Min" ToolTip="Select All" />
</Grid>
</GridViewColumn>
</GridView>
</ListView.View>
</ListView>
I've tried using Commands and Command Parameters, PropertyChanged events on the Checked property, and handling the Checked event in my code behind, but nothing gives me enough information to know what to change in the collection I'm bound to.
I suppose I could create a separate event handler for each, but I'd like to be able to handle this in a single event handler if possible, because eventually I will be creating a custom control that is a bit more malluable in terms of the columns displayed.
Thanks in advance
AveragingParameterswhen user either check or uncheckchkAvgSelectAllorchkMinSelectAll?