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
145
XamDataGrid hierarchy with checkboxes
posted

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

Parents
  • 9836
    Suggested Answer
    posted

    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 helps

    Regards

    Vlad.

    WPF_Checkboxes.zip
Reply Children
No Data