This project is read-only.

Treeview items

May 18, 2010 at 10:31 AM


I'm working on silverlight project and now facing huge difficulties with getting treeitems by names...

Could anyone please help me with this...?

May 18, 2010 at 1:07 PM

which way do you try?


short code snippet please.


May 19, 2010 at 3:38 PM
Edited May 20, 2010 at 2:56 PM
This is the most workable result, it doesn't find the suggested treeitem, when running it hovers mouse over all the tree items

tree = _sl.Get<Tree>("treeDocBrowser"); var nodes = tree.AutomationElement.FindAll(TreeScope.Descendants, new PropertyCondition(AutomationElement.ClassNameProperty, "TreeViewItem")); UIItem treeItem; treeItem = null; foreach (AutomationElement node in nodes) { var docfolder = new UIItem(node, _sl.ActionListener); if (docfolder.Name == "Folder") { treeItem = docfolder; break; } Assert.IsNotNull(docfolder); }


May 20, 2010 at 8:19 PM
Edited May 20, 2010 at 8:20 PM



have you tried


Tree tree = _sl.Get<Tree>("treeDocBrowser");

TreeNode node = tree.Nodes.Where(p=>p.Name == "node name").First();


can you show a LogStructure(). on the tree element?


or can you post tree item details of UISpy or UIAVerify?






May 26, 2010 at 10:26 AM


Yes, I tried this, it threw exception.

I finally did it using this article

Thanks for your attentention