Converting itemcollection to RadTreeViewItem

2 posts, 0 answers
  1. Runjith
    Runjith avatar
    26 posts
    Member since:
    Mar 2014

    Posted 12 Mar 2014 Link to this post

    Hi All,

    Here "ItemCollection"  having 2 items.I am ssigning one  item to RadTreeViewItem as shown bellow.

    Inside i am calling same method and assigning RadTreeViewItem(Insted of ItemCollection), if i call like this i am getting error "Can not convert type RadTreeViewItem  to ItemCollection "

    BuildConfigDetailsData_Helper(ItemCollection ndcol, ref string strConfigDetailsData)
                string strImagesPath = "file:///" + _Params.SizerFolderName + "xml\\";
                RadTreeViewItem nd;
                for (int iCount = 0; iCount < ndcol.Count; iCount++)
                    nd = (RadTreeViewItem)ndcol[iCount];

       BuildConfigDetailsData_Helper((ItemCollection)nd, ref strConfigDetailsData);

    Please help me how can i proceed..........................
  2. Petar Mladenov
    Petar Mladenov avatar
    2986 posts

    Posted 17 Mar 2014 Link to this post

    Hello Ranjith,

    The mentioned error is probably caused by this cast:
    nd = (RadTreeViewItem)ndcol[iCount];
    in your code. You can assign only RadTreeViewItem only to RadTreeViewItem. Please double check this line.  On a side note please have in mind that when you populate RadTreeView you have to use either its ItemsSource collection only or its Items collection only. ItemsSource when you bind the RadTreeView to business objects and Items when you directly add RadTreeViewItems.

    Petar Mladenov

    DevCraft Q1'14 is here! Watch the online conference to see how this release solves your top-5 .NET challenges. Watch on demand now.

Back to Top