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

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

 2009-03-14 12:00:33 来源:WEB开发网   
核心提示: 其中,节点的header属性为object类型,这样我们可以根据需求,Silverlight Treeview 相关操作:加载,保存,索引节点,节点移动,模板节点(3),为其赋予需要的控制项,设置定制节点private void setTitleData(Grid grid) { Text

其中,节点的header属性为object类型,这样我们可以根据需求,为其赋予需要的控制项。

设置定制节点

private void setTitleData(Grid grid)
        {
            TextBlock Phase = new TextBlock();
            Phase.Text = "Phase";


            Grid.SetColumn(Phase, 0);
            grid.Children.Add(Phase);

            Phase = new TextBlock();
            Phase.Text = "Task";

            Grid.SetColumn(Phase, 1);
            grid.Children.Add(Phase);

            Phase = new TextBlock();
            Phase.Text = "Item";

            Grid.SetColumn(Phase, 2);
            grid.Children.Add(Phase);

            Phase = new TextBlock();
            Phase.Text = "工期";

            Grid.SetColumn(Phase, 3);
            grid.Children.Add(Phase);


            Phase = new TextBlock();
            Phase.Text = "开始时间";

            Grid.SetColumn(Phase, 4);
            grid.Children.Add(Phase);

            Phase = new TextBlock();
            Phase.Text = "实际开始时间";

            Grid.SetColumn(Phase, 5);
            grid.Children.Add(Phase);

            Phase = new TextBlock();
            Phase.Text = "完成时间";

            Grid.SetColumn(Phase, 6);
            grid.Children.Add(Phase);

            Phase = new TextBlock();
            Phase.Text = "实际完成时间";

            Grid.SetColumn(Phase, 7);
            grid.Children.Add(Phase);
        }

        private void setGridData(Grid grid, string str, int id)
        {
            //序号
            TextBlock flag = new TextBlock();
            flag.Tag = id;
            Grid.SetColumn(flag, 0);
            grid.Children.Add(flag);

            //名称
            TextBlock lbl = new TextBlock();
            lbl.Text = "[" + id.ToString() + "]" + str;
            //lbl.Text = str;
            Grid.SetColumn(lbl, 1);
            grid.Children.Add(lbl);

            //工期
            TextBox txt = new TextBox();
            txt.IsEnabled = false;
            Grid.SetColumn(txt, 2);
            grid.Children.Add(txt);

            //开始时间
            DatePicker dp = new DatePicker();
            dp.IsEnabled = false;
            Grid.SetColumn(dp, 3);
            grid.Children.Add(dp);

            //实际开始时间
            dp = new DatePicker();
            Grid.SetColumn(dp, 4);
            grid.Children.Add(dp);


            //完成时间
            dp = new DatePicker();
            dp.IsEnabled = false;
            Grid.SetColumn(dp, 5);
            grid.Children.Add(dp);

            //实际完成时间
            dp = new DatePicker();
            Grid.SetColumn(dp, 6);
            grid.Children.Add(dp);

        }

        private Grid getGridTemplate()
        {
            Grid grid = new Grid();
            RowDefinition row1 = new RowDefinition();
            grid.RowDefinitions.Add(row1);

            //id
            ColumnDefinition col = new ColumnDefinition();
            col.Width = new GridLength(1);
            grid.ColumnDefinitions.Add(col);

            //ITem Name
            col = new ColumnDefinition();
            col.Width = new GridLength(250);
            grid.ColumnDefinitions.Add(col);

            //工期
            col = new ColumnDefinition();
            col.Width = new GridLength(50);
            grid.ColumnDefinitions.Add(col);

            //计划开始时间
            col = new ColumnDefinition();
            col.Width = new GridLength(150);
            grid.ColumnDefinitions.Add(col);

            //实际开始时间
            col = new ColumnDefinition();
            col.Width = new GridLength(150);
            grid.ColumnDefinitions.Add(col);

            //完成时间
            col = new ColumnDefinition();
            col.Width = new GridLength(150);
            grid.ColumnDefinitions.Add(col);

            //实际完成时间
            col = new ColumnDefinition();
            col.Width = new GridLength(150);
            grid.ColumnDefinitions.Add(col);

            return grid;
        }

        private Grid getTitleGridTemplate()
        {
            Grid grid = new Grid();
            RowDefinition row1 = new RowDefinition();

            grid.RowDefinitions.Add(row1);

            //Phase
            ColumnDefinition col = new ColumnDefinition();
            col.Width = new GridLength(40);
            grid.ColumnDefinitions.Add(col);

            //task
            col = new ColumnDefinition();
            col.Width = new GridLength(50);
            grid.ColumnDefinitions.Add(col);

            //item
            col = new ColumnDefinition();
            col.Width = new GridLength(210);
            grid.ColumnDefinitions.Add(col);

            //工期
            col = new ColumnDefinition();
            col.Width = new GridLength(50);
            grid.ColumnDefinitions.Add(col);

            //计划开始时间
            col = new ColumnDefinition();
            col.Width = new GridLength(150);
            grid.ColumnDefinitions.Add(col);

            //实际开始时间
            col = new ColumnDefinition();
            col.Width = new GridLength(150);
            grid.ColumnDefinitions.Add(col);

            //计划完成时间
            col = new ColumnDefinition();
            col.Width = new GridLength(150);
            grid.ColumnDefinitions.Add(col);

            //实际完成时间
            col = new ColumnDefinition();
            col.Width = new GridLength(150);
            grid.ColumnDefinitions.Add(col);

            return grid;
        }

上一页  1 2 3 4 5  下一页

Tags:Silverlight Treeview 相关

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