Silverlight Treeview 相关操作:加载,保存,索引节点,节点移动,模板节点
2009-03-14 12:00:33 来源:WEB开发网 private void AddTreeNodeForProject(int parentID, TreeViewItem treeViewItem)
{
List<ProjectInfo> result = (from Info in listsForProject
where Info.ParentID == parentID
select Info).ToList<ProjectInfo>();
if (result.Count > 0)
{
foreach (ProjectInfo info in result)
{
TreeViewItem objTreeNode = new TreeViewItem();
objTreeNode.IsExpanded = true;
//如果是叶子节点,为其加载模板控制项
if (info.Grade == 3) //叶子节点绑定 时间控制项
{
Grid grid = getGridTemplate();
setGridData(grid, info.Name, info.ID);
objTreeNode.Header = grid;
}
else
{
objTreeNode.Header = "[" + info.ID + "]" + info.Name;
}
//添加根节点
if (treeViewItem == null)
{
tvshow.Items.Add(objTreeNode);
}
else
{
treeViewItem.Items.Add(objTreeNode);
}
//递归加载
AddTreeNodeForProject(info.ID, objTreeNode);
}
}
}
Tags:Silverlight Treeview 相关
编辑录入:爽爽 [复制链接] [打 印]- ››silverlight全屏显示图片
- ››Silverlight MVVM 模式(一) 切近实战
- ››Silverlight for Windows Phone 7开发系列(1):...
- ››Silverlight for Windows Phone 7开发系列(2):...
- ››Silverlight for Windows Phone 7开发系列(3):...
- ››Silverlight for Windows Phone 7开发系列(4):...
- ››Silverlight for Symbian
- ››Silverlight3系列(四)数据绑定 Data Binding 1
- ››silverlight2 游戏 1 你能坚持多少秒
- ››Silverlight开发实践--PicZoomShow
- ››Silverlight自定义控件开发 - 令人懊恼的OnApplyT...
- ››Silverlight 2 RTW中ToolTipService.ToolTip不继承...
更多精彩
赞助商链接