c# - TreeView only loads top nodes -


i have node class i'm trying use populate treeview in silverlight:

class treenode {     public string caption {get; set;};     public ienumerable<treenode> children{get; set;}  } 

my xaml follows:

<controls:treeview verticalalignment="stretch"                            x:name="trv"                           height="150" >             <controls:treeview.itemtemplate>                 <common:hierarchicaldatatemplate itemssource="{binding path=children}" >                     <textblock text="{binding path=caption}" />                 </common:hierarchicaldatatemplate>             </controls:treeview.itemtemplate>         </controls:treeview> 

however, first tier of elements load. if replace textblock herarchicaldatatemplate, hard-coding data depth, 2nd tier of elements displayed. 3rd tier not.

any ideas?

i tried out, must doing wrong on data binding part, since working expected. created simple example xaml below.

output:

alt text

xaml:

<controls:treeview verticalalignment="stretch"                     x:name="trv"                   height="150" >     <controls:treeview.itemtemplate>         <controls:hierarchicaldatatemplate itemssource="{binding path=children}" >             <textblock text="{binding path=caption}" />         </controls:hierarchicaldatatemplate>     </controls:treeview.itemtemplate> </controls:treeview> 

code:

    treenode mynode = new treenode() { caption = "parent" };     list<treenode> mychildren = new list<treenode>();      mychildren.add(new treenode() { caption = "first child" });     mychildren.add(new treenode() { caption = "second child", children = new list<treenode>() { new treenode() { caption = "child on 3rd level" } } });       mynode.children = mychildren;     trv.itemssource = new list<treenode>() { mynode }; 

Comments

Popular posts from this blog

Add email recipient to all new Trac tickets -

400 Bad Request on Apache/PHP AddHandler wrapper -

php - Change action and image src url's with jQuery -