Hi, I implemented a column of checkboxes in my grid for selecting the row. I followed the example here: http://community.infragistics.com/forums/p/52125/271646.aspx
I am trying to implement this for all my grids, so I have derived a new class from XamGrid, and I am using that instead of the base Infragistics class.
The problem is that I want to add a "Check all" checkbox to theheader. I was able to do that by creating a DataTemplate in OnApplyTemplate in XamGrid.cs:
CheckboxStateColumn selectedColumn = new CheckboxStateColumn(CheckedItems); selectedColumn.Key = "IsSelected"; selectedColumn.Width = new ColumnWidth(40, false); selectedColumn.HeaderText = " "; selectedColumn.HeaderTemplate = Application.Current.Resources["CheckAllTemplate"] as DataTemplate; this.Columns.Insert(0, selectedColumn);
CheckAllTemplate is defined like this in a resource dictionary:
<DataTemplate x:Key="CheckAllTemplate"> <CheckBox Command="{Binding CheckAllCheckedCommand}" /> </DataTemplate>
The checkbox shows up, the problem is that my CheckAllCheckedCommand is never called. I think this is because the DataContext is missing. How can I get this to work?
Hello jbaumgartner,
I have been looking into your post and I can suggest looking through the following blog that presents a custom approach on how to add a ‘Select All’ Checkbox to a XamGrid CheckboxColumn Header :
http://blogs.infragistics.com/blogs/devin_rader/archive/2011/04/29/adding-a-select-all-checkbox-to-a-xamgrid-checkboxcolumn-header.aspx
If you need any further assistance on this matter, do not hesitate to ask.
Thanks, I've seen that one. The trouble with that is it requires me to update my model, which I do not want to do, and it is not generic for all grids. I don't want to add code for every single instance of the grid.