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
55
Silverlight XamDataTree and "Lazy Loading"
posted

Hi all,

I'd like to use lazy loading in my Silverlight XamDataTree. I've already read this topic :

http://blogs.infragistics.com/forums/t/50958.aspx

But it doesn't help me. While clicking on the expansion indicator, I'd like the "ghost" node to disappear and my wanted nodes to be loaded. I think it's like dynamically add nodes in the tree.

Here is an example :

Normal 0 21 false false false FR X-NONE X-NONE MicrosoftInternetExplorer4

void resultXdt_NodeExpansionChanged(object sender, NodeExpansionChangedEventArgs e)

        {

            XamDataTree xdt = sender as XamDataTree;

            XamDataTreeNode xdtnode = e.Node;

           

            //XDTNode is the type of all my nodes, DisplayMemberPath is set on "Description" attribute

            XDTNode xdtn = xdtnode.Data as XDTNode;

           

            //RelatedTo is a collection of XDTNode children

            //Here I remove a ghost XDTNode used to show the expansion indicator

            xdtn.RelatedTo.Clear();

           

            //Here I add a testing node in the "RelatedTo" collection

            xdtn.RelatedTo.Add(new XDTNode()

            {

                Name = "try",

                Description = "try",

                RelatedTo = new List<XDTNode>()

            });

 

        }

With this the tree does not update automatically when I expand my first node, I always see my "ghost" node, and I don't see my "try" node.

I'd like to use this kind of functionallity to avoid endless loop in my code, because I use this control in a particular way...

Does any one have an idea ? Did I miss something ? Do you understand my request ?

Thank you all


  • 55
    posted

    Hi again,

    Here was my mistake :

    Using a List<XDTNode> won't allow the tree to see the change. I changed with ObservableCollection<XDTNode> and now it works just fine.

    Thank you anyway :)