Pouplate Data in RadTreeView via collection

2 posts, 0 answers
  1. Harsh
    Harsh avatar
    8 posts
    Member since:
    Jan 2009

    Posted 29 Jan 2009 Link to this post

    I have a collection which contains two properties
    1. ABC
    2. XYZ

    I want to make XYZ as the child of ABC For example:


    I want to bind this in .XAML.CS page

    Currently what I have done in XAML


    <Telerik:RadTreeView x:Name="RadTreeView" DockPanel.Dock="Bottom"/>



    In XAML.CS page
    Collection is CommodityCollection








    for (int i = 0; i < CommodityCollection.Count; i++) {


    aa = new RadTreeViewItem();



     aa.Header = CommodityCollection[i].ABC;



    Now my problem is How to add child node in the RadTreeView?



  2. Valentin.Stoychev
    Valentin.Stoychev avatar
    2198 posts

    Posted 30 Jan 2009 Link to this post

    Hi Harsh,

    You can get the items that you have added in the root levev by using

    RadTreeViewItem item = this.RadTreeView.Items[0] as RadTreeViewItem;

    and then to use its Items collection to add the childs.


    Please let us know if you have any other questions!

    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Back to Top