Expanded Event issue

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

    Posted 03 Feb 2009 Link to this post

       I am using expanded event of the WPF Treeview to populate children of the parent node when the parent node is clicked.

    I am binding my treeview with the collection. Collection has 2 things
    a. Name
    b. Commodity

    On page load:


    .RadTreeView.Items.Add(new RadTreeViewItem()



    Header = "Name"




    this.RadTreeView.Items.Add(new RadTreeViewItem()



    Header = "Commodity"



    Now I want to show the children under commodity on click of commodity (parent node).



    void RadTreeView_Expanded(object sender, Telerik.Windows.RadRoutedEventArgs e) { 






    RadTreeView objRadTreeView = sender as RadTreeView;




    RadTreeViewItem objRadItem = e.OriginalSource as RadTreeViewItem;




    CommodityCollection objCommodityCollection = this.CommodityCollection;





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














    Now the issue is when I run the application, as currently there are no child for commodity I am not getting expand icon on the left side of commodity (when the page is loaded) because of which Expanded event is not called.

    How to resolve this issue?




  2. Tihomir Petkov
    Tihomir Petkov avatar
    576 posts

    Posted 03 Feb 2009 Link to this post

    Hello Harsh,

    Please refer to the following two blog posts:


    I believe these article clarify what you want to know - let me know if you still need assisstance after reading them.

    Best wishes,
    Tihomir Petkov
    the Telerik team

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