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
290
XamDataTree with ViewModel itemsource and Checkboxes
posted

Hello, I have a XamDataTree defined as follows:

                       

<ig:XamDataTree x:Name="_MenuTree"
                        ItemsSource="{Binding Menus}"
                       SelectedDataItems="{Binding SelectedMenuItems}"
                        NodeLineVisibility="Visible"
                         IsExpandedMemberPath="IsExpanded"
                        NodeCheckedChanged="TreeNodeCheckedChanged">
                    <ig:XamDataTree.CheckBoxSettings>
                              <ig:CheckBoxSettings CheckBoxVisibility="Visible"
                                                           CheckBoxMode="Auto" />
                    </ig:XamDataTree.CheckBoxSettings>
                    <ig:XamDataTree.SelectionSettings>
                                          <ig:TreeSelectionSettings NodeSelection="Multiple" />
                     </ig:XamDataTree.SelectionSettings>
                     <ig:XamDataTree.GlobalNodeLayouts>
                                              <ig:NodeLayout Key="MenuLayout"
                                                                       TargetTypeName="clsMenuItem"
                                                                       DisplayMemberPath="Description"
                                                                       CheckBoxMemberPath="IsSelected">

                                               </ig:NodeLayout>
                        </ig:XamDataTree.GlobalNodeLayouts>
</ig:XamDataTree>

The Menus property is in the ViewModel and is an ObservableCollection of clsMenuItem. clsMenuItem has the following properties: ID (int), Description (string) and ChildItems (ObservableCollection(of clsMenuItem))

I looked at one of the other similar posts on the forums board, but in my case, I don't see anything on the screen when then form loads, even though the Menus property has proper stuff in it.

What am I missing / doing wrong?

Parents
  • 14517
    Offline posted

    Hello Manasi,

    Your code appears to be correct, unless there is some sort of issue with data context not being propagated down to the tree, I don’t see any issue with this. I created a sample using the description of your data and your XAML and the tree appeared as expected. Please review the sample and see if you notice may differences which may attribute to your issue.

    Let me know if you have any questions.

    Sincerely

    Valerie

    Software Developer

    Infragistics Inc

    DataTree.zip
Reply Children