Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
455
Unbound Checkbox problem
posted

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?

 

Parents Reply Children