This is a migrated thread and some comments may be shown as answers.

Converting itemcollection to RadTreeViewItem

1 Answer 93 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Runjith
Top achievements
Rank 2
Runjith asked on 12 Mar 2014, 02:42 PM
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..........................

1 Answer, 1 is accepted

Sort by
0
Petar Mladenov
Telerik team
answered on 17 Mar 2014, 09:57 AM
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.

Regards,
Petar Mladenov
Telerik
 

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

 
Tags
TreeView
Asked by
Runjith
Top achievements
Rank 2
Answers by
Petar Mladenov
Telerik team
Share this question
or