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
1647
Re: Hierarchical data binding in xamtree
posted

Hi

I was reading along about the hierarchical data binding for the XAM tree,, can anyone please help me figure out the following scenario:


   1. ID                       Parent ID                        Name                    Code
   2. 1                         Null                                 DE                          DE
   3. 2                         NULL                              MAUM                     MAUM
   4. 3                         2                                      M/F   Ex                   M/F EX
   5. 4                         2                                      M/F EY                     M/F EY
 
The number of levels to which the tree  can go down is not fixed

 

The data template i am using is;'

<igTree:XamWebTree IsDraggable="True" Name="xamWebTree1" Width="Auto" AllowDrop="True" Height="auto" >                
                 
                    <igTree:XamWebTree.HierarchicalItemTemplate>
                        <ig:HierarchicalDataTemplate ItemsSource="{Binding MyChildren}">
                            <ig:HierarchicalDataTemplate.ItemTemplate>
                            <DataTemplate>
                                <TextBlock Text="{Binding DisplayName}"/>
                            </DataTemplate>
                            </ig:HierarchicalDataTemplate.ItemTemplate>
                         
                                <DataTemplate>
                                    <TextBlock Text="{Binding DisplayName}" />
                                </DataTemplate>
                          
                        </ig:HierarchicalDataTemplate>
                    </igTree:XamWebTree.HierarchicalItemTemplate>
                </igTree:XamWebTree>

The list<T> that i am assigning as a items source is generated in the back end and the class structure is::

 public class NodeItem
    {
        public long ParentId { get; set; }

        public string DisplayName { get; set; }

        public string Code { get; set; }

        [Key]
        public long Id { get; set; }

        [Association("MyChildren", "Id", "ParentId")]       
        public List<NodeItem> MyChildren { get; set; }

        public NodeItem()
        {
        }
      
    }

Right now I get all the elements in one single flat level.. the hierarchies is not getting populated.

Please reply as soon as possible..

Thanks

 

Parents Reply Children
No Data