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

how to find the radtreeviewitem in the radtreeview using lamda expression ?

1 Answer 77 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
sunil nair
Top achievements
Rank 1
sunil nair asked on 15 Dec 2011, 03:35 PM
Hi,

I'm using the silverlight version of Radtreeview control. 

I'm loading the tree using this method - radtreeview.items.add(radtreeviewitem).

I need to filter out  the radtreeviewitem in the radtreeview by it's name.

I use the following lamda expression for the same, it only filters out the radtreeviewitem which is directly under the root node, but is not able to filter out the radtreeviewitem which is the child item of items directly under the root nodem i.e not able to search all children.

radTreeView.Items.Cast<RadTreeViewItem>().FirstOrDefault().Items.Cast<RadTreeViewItem>().Where(q => q.Name == StrParentKey)


Basically I am looking to achieve the same thing which can be done in windows treeview control like

tree.Nodes.Find(StrParentKey,    -- the second parameter true will make sure it searches all children

true);

Could someone please help me ?

Thanks,
Sunil.


1 Answer, 1 is accepted

Sort by
0
Petar Mladenov
Telerik team
answered on 19 Dec 2011, 01:02 PM
Hi Sunil Nair,

I prepared a sample project where I use your code and implement successful search by the RadTreeViewItem's Header and Name.

Could you please check it out and let us know if we have missed something or just modify it so that the problem is reproducible? Thank you in advance for your cooperation.

Greetings,
Petar Mladenov
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
TreeView
Asked by
sunil nair
Top achievements
Rank 1
Answers by
Petar Mladenov
Telerik team
Share this question
or