惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

V
Visual Studio Blog
Microsoft Azure Blog
Microsoft Azure Blog
WordPress大学
WordPress大学
小众软件
小众软件
Last Week in AI
Last Week in AI
月光博客
月光博客
博客园 - 聂微东
Recent Announcements
Recent Announcements
A
About on SuperTechFans
博客园 - 三生石上(FineUI控件)
V
V2EX
阮一峰的网络日志
阮一峰的网络日志
博客园 - Franky
云风的 BLOG
云风的 BLOG
量子位
N
Netflix TechBlog - Medium
Hugging Face - Blog
Hugging Face - Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
J
Java Code Geeks
博客园 - 司徒正美
S
SegmentFault 最新的问题
有赞技术团队
有赞技术团队
Google DeepMind News
Google DeepMind News
宝玉的分享
宝玉的分享

博客园 - syuko

【转】IE8 松散耦合进程框架探索 【转】Windows 文件夹的秘密:Windows 目录到底占用了多少真实的硬盘空间 【转】d:DesignInstance, d:DesignData in Visual Studio 2010 Beta2 RadTreeViewItem - event MouseLeftButtonDown or Up never fires visual studio 2005 中的部署 产生“不可恢复的生成错误” Windows 7使用记事及琐事流水帐-职称英语考试始末记事 Oracle难道不能处理大数据并发的问题 [转载]DNS解析错误解决办法 鼠标(Mouse)的复数问题告诉我们治学要严谨 Just for Fun-生存,社会秩序,娱乐 软件创作 VB6.0通过SoapToolkit访问WebService问题 [转] oracle rownum 探析 用MSIL来写一个“Hello World” 天地生人,有一人莫不有一人之业;人生在世,有一日当尽一日之勤 小窥黄鹤楼 JavaScript基础之继承(二) JavaScript基础之继承(附实例) JavaScript基础之对象
RadTreeView:How to Get Item by Path
syuko · 2011-03-18 · via 博客园 - syuko

Telerik官方说:“The RadTreeView API offers you the ability to get an item by path programmatically. This tutorial will show you how to do that.”。并给出了如下的使用方法:

For example, see the following situation - you want to retrieve the treeview item with Header Soccer. In order to do that you need to perform the following steps:

1. Create a path, including only the treeview items' header and using some separator.

2. Set the telerik:TextSearch.TextPath attached property to indicate which property to be used as a path segment.

3. Invoke the GetItemByPath() method of the RadTreeView class. 

和例子:

private void GetTreeViewItemByPath()
{
   
string path = "Sport Categories|Football|Soccer";
   RadTreeViewItem targetItem = radTreeView.GetItemByPath( path,
"|" );
}

其中Telerik列举了很多注意事项,其中有一条是:“Using the GetItemByPath() method of the RadTreeViewItem class is a potentially expensive operation if the item is not visible. The method will recursively expand and scroll items into view, updating the layout numerous times. Almost certainly the method should not be called in a loop (multiple times). If you need to do so, there is probably a better way to achieve what you need.”,这句话说明了节点不可见时是一项比较消耗资源的操作,可Telerik没说当整个RadTreeView不可见(或不属于当前选中窗体)时该方法会返回Null,所以在实际多选项卡的应用程序中,如果调用一个不是当前选项卡页面(或是隐藏)里的RadTreeView的GetItemByPath时一般返回的就是Null。正确的做法是先将该选项卡设为Selected或isHidden=false然后再去GetItemByPath;