WEB开发网
开发学院图形图像Flash Silverlight Treeview 相关操作:加载,保存,索引节... 阅读

Silverlight Treeview 相关操作:加载,保存,索引节点,节点移动,模板节点

 2009-03-14 12:00:33 来源:WEB开发网   
核心提示: private void AddTreeNodeForProject(int parentID, TreeViewItem treeViewItem) { List<ProjectInfo> result = (from Info in listsForProject whe

     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);
                }
            }
        }

上一页  1 2 3 4 5  下一页

Tags:Silverlight Treeview 相关

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接