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
310
How to Bind the UltraTree in the proper way?
posted

I am trying to bind the UltraTree using a Linq extension which return a hirarchical structure.

Unfortunately the tree is displaying the data in a bizarre way ...

The structure is 

Object
 - Name
 -IList<Object>

Where of course for each IList<Object> there can be an additional list of childs

The treeview shows me only the 4 nodes in the root and an additional column containing the full structure of the childs displayed using the toString() method of the IList<T>

How it works this control?  

Parents
  • 310
    posted

    Just to clarify this is the code I am using:

    A hierarchy structure of objects:

        public sealed class WorkflowLogHierarchy
        {
            public WorkflowLogContract Log { get; set; }
    
            public IList Childs { get; set; }
    
        }
    

    Then I have created a simple extension which create the correct tree structure

            public static IList GetJobHierarchy(this IList allLogs, WorkflowLogContract parentLog)
            {
                Guid? parentUid = null;
                if (parentLog != null)
                {
                    parentUid = parentLog.UniqueId;
                }
    
                var childLogs = allLogs.Where(x => x.ParentUniqueId == parentUid);
    
                List hierarchy = new List();
    
                foreach (var childLog in childLogs)
                {
                    hierarchy.Add(new WorkflowLogHierarchy { Log = childLog, Childs = GetJobHierarchy(allLogs, childLog) });
                }
                return hierarchy;
            }
    
    

    This code works because if I bind this structure to a WPF treeview or a simple WInFOrm treeview I get the expected result. On you control I just get a weird and bizarre result so it means that your control has some constraint on the data it can displays. Can you explain me how I should structure the data for your control? Thank you

     

Reply Children
No Data