I've implemented a hierarchical grid and have used the checkbox sample as a baseline. The problem I'm having is that each of my headers (n-level) need to call their appropriapte View Model to do the checking/unchecking of their children.
<CheckBox HorizontalAlignment="Center" VerticalAlignment="Center" IsChecked="{Binding ???" />
Each level ViewModel contains a list and a bool field. I have tried several things but cannot seem to get the right object reference.
Any ideas or suggestions?
chr15t1an
Hello,One possible implementation can be different styles for the HeaderPrefixAreaStyle and RecordSelectorStyle for each hierarchy level.For example we have a 2 level hierarchy - class Person which has a collection of friends List<Friend>. Both Person and Friend classes have IsSelected property (IsPSelected and IsFSelected).<igDP:FieldLayout> <igDP:FieldLayout.Settings> <igDP:FieldLayoutSettings
HeaderPrefixAreaStyle="{StaticResource headerPrefixAreaStyle1}" RecordSelectorStyle="{StaticResource recordSelectorStyle1}"/> </igDP:FieldLayout.Settings> <igDP:FieldLayout.Fields > <igDP:Field Name="PLastName" Label="Parent Last name" /> <igDP:Field Name="PFirstName" Label="Parent First name" /> <igDP:Field Name="PFriends" Label="friends"/> <igDP:Field Name="IsPSelected" Visibility="Collapsed" /> </igDP:FieldLayout.Fields></igDP:FieldLayout><igDP:FieldLayout> <igDP:FieldLayout.Settings> <igDP:FieldLayoutSettings
HeaderPrefixAreaStyle="{StaticResource headerPrefixAreaStyle2}" RecordSelectorStyle="{StaticResource recordSelectorStyle2}"/> </igDP:FieldLayout.Settings> <igDP:FieldLayout.Fields > <igDP:Field Name="FLastName" Label="friend last name" /> <igDP:Field Name="FFirstName" Label="friend first name" /> <igDP:Field Name="IsFSelected" Visibility="Collapsed" /> </igDP:FieldLayout.Fields> </igDP:FieldLayout> For more details i've attached a sample project.
Hope this helpsRegardsVlad.
Thanks for the response. I'll give it a go
Vlad,
Per the example, is it possible to use an existing checkbox which is part of the layout to attach the checkAll heading? I have a datagrid with several bool type for which I would like to select all.
Great example.
Ideas appreciated.
Glenn
Anyone,
Ok, I got this sample going and incorporated into my project. Good. Now, is it possible to place the checkAll RecordSelecter in the heading of one of my fields instead of one end of the grid? Also, what if I have 3 columns for which I want to choose checkAll or checkNone without affecting the other rows?
It seems like this feature is mearly a record marker and not intended to select all checkboxes in a specific column.
Screenshot attached.
Thanks,
Hello Glenn,
I think there is an online blog post by Josh Smith that is very close to what you need -- please check it out here.
http://blogs.infragistics.com/blogs/josh_smith/archive/2008/09/04/adding-checkboxes-to-the-record-selectors-in-xamdatagrid.aspx
The post demonstrates how to check all checkboxes in a grid field with a parent master checkbox in the header.