Esempio n. 1
0
        private void FillOurTreeView()
        {
            #region Old way

            //TreeViewNode t1 = new TreeViewNode("test1");
            //treeViewControl1.Root.Children.Add(t1);

            //TreeViewNode t11 = new TreeViewNode("subtest11");
            //t1.VMembers.Children.Add(t11);

            //TreeViewNode t12 = new TreeViewNode("subtest12");
            //t1.VMembers.Children.Add(t12);

            //TreeViewNode t2 = new TreeViewNode("test2");
            //treeViewControl1.Root.Children.Add(t2);
            //t2.MyNodeControl.TreeLineStyle = RedLineStyle;

            //TreeViewNode t21 = new TreeViewNode("subtest21");
            //t2.VMembers.Children.Add(t21);

            //TreeViewNode t22 = new TreeViewNode("subtest22");
            //t2.VMembers.Children.Add(t22);
            ////t21.VMembers.Children.Add(new SampleRootBlock());

            //TreeViewNode t211 = new TreeViewNode("subtest211");
            //t21.VMembers.Children.Add(t211);
            //// t21.HMembers.Children.Add(new ButtonBlock("Hello"));

            #endregion

            #region New way

            TreeViewNode t1   = treeViewControl1.AddNode("test1");
            TreeViewNode t11  = t1.AddNode("subtest11");
            TreeViewNode t12  = t1.AddNode("subtest12");
            TreeViewNode t2   = treeViewControl1.AddNode("test2");
            TreeViewNode t21  = t2.AddNode("subtest21");
            TreeViewNode t211 = t21.AddNode("subtest211");
            TreeViewNode t22  = t2.AddNode("subtest22");

            #endregion

            NodeRelationship r = new NodeRelationship();
            r.Sender    = t11;
            r.Receivers = new List <Block>();
            r.Receivers.Add(t22);
            r.Receivers.Add(t21);

            treeViewControl1.Root.Relationship = r;
        }
Esempio n. 2
0
 /// <summary>
 /// Adds the nodes.
 /// </summary>
 /// <param name="root">The root.</param>
 /// <param name="fields">The fields.</param>
 internal static void AddNodes(this TreeViewNode root, IEnumerable <XCrmField> fields)
 {
     foreach (var field in fields.Where(field => !field.Disabled))
     {
         root.AddNode(field);
     }
 }
        private async Task TreeViewForms_Init(object sender, InitEventArgs e)
        {
            view = new TreeView();

            var tvn = new TreeViewNode("Cars", "cars");

            tvn.AddNode(new TreeViewNode("Porsche", "porsche", new TreeViewNode("Website", "web", "https://www.porsche.com/germany/"), new TreeViewNode("911", "911"), new TreeViewNode("918 Spyder", "918")));
            tvn.AddNode(new TreeViewNode("BMW", "bmw"));
            tvn.AddNode(new TreeViewNode("Audi", "audi"));
            tvn.AddNode(new TreeViewNode("VW", "vw"));
            tvn.AddNode(new TreeViewNode("Lamborghini", "lamborghini"));

            view.Nodes.Add(tvn);

            tvn = new TreeViewNode("Fruits", "fruits");

            tvn.AddNode(new TreeViewNode("Apple", "apple"));
            tvn.AddNode(new TreeViewNode("Orange", "orange"));
            tvn.AddNode(new TreeViewNode("Lemon", "lemon"));

            view.Nodes.Add(tvn);

            this.AddControl(view);
        }