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,
I am just checking if you require any further assistance on the matter.
Hello jbaumgartner,
Thanks for your feedback.
If you need any further assitance, feel free to ask.
For some reason, I wasn't notified about your previous reply. Thanks for that. I'll take a look and see if it works.
I have been looking into your post and the easiest way, not to handle every time the events of the XamGrid and creating a DataTemplate, that I can think of is to put our XamGrid in an UserControl in which to make the necessary modifications. This way you will be able to create several instances of the UserControl and to define the data source for each one manually.
I am sending you a modified version of my previous sample application(ModifiedSample2.zip). If it does not meet your requirements, feel free to tell me.
Sincerely,
Yanko
Developer Support Engineer
Infragistics, Inc.
www.infragistics.com/support