Menu

No text appearing

2007-01-09
2015-06-29
  • Phileosophos

    Phileosophos - 2007-01-09

    I fear I'm missing something obvious, but to make use of your control I (1) added it to my toolbox, (2) dropped it onto my form, and (3) added the following code to the form load handler for testing:

                TreeModel Model = new TreeModel();
                Node RootNode = new Node("My Big Testing Root Node");
                Model.Nodes.Add(RootNode);

                treeViewAdv1.BeginUpdate();
                treeViewAdv1.Model = Model;
                treeViewAdv1.EndUpdate();

    When I run the sample application, the control appears, and it has a root, but the root has no text. Adding child nodes results in the same thing; i.e., I can expand the root and it will show the correct number of children, but no text appears. Can anyone offer me advice as to what I may be doing wrong? I'm using this with Visual Studio 2005. Thanks!

     
    • Nobody/Anonymous

      Bump?

       
    • Nobody/Anonymous

      Bump for another user!

       
    • Nobody/Anonymous

      You have to add a nodeTextBox in your nodeCollection and set the nodeTextBox dataProperty to "Text".
      It can be done via the visual property explorer.

       
    • Nobody/Anonymous

      I had the same problem, but the visual property explorer gave the following error:

      The value "NodeTextBox" is not a type "Aga.Controls.Tree.NodeControls.NodeControl" and
      cannot be used in this generic collection.
      Parameter name: value.

      instead I wrote the following code to get a basic example working:

      NodeTextBox tb = new NodeTextBox();
                   tb.DataPropertyName = "Text";
                  treeViewAdv1.NodeControls.Add(tb);
                  TreeModel model = new TreeModel();
                 
                  for (int i = 0; i < 5; i++)
                  {
                      Node n = new Node("abc " + i.ToString());
                      model.Nodes.Add(n);
                  }
      this.treeViewAdv1.Model = model;

       
    • Nobody/Anonymous

      You also have to set the ParentColumn member in the node to be the name of the column you want your text in. Your Text is invisible if ParentColumn is blank

       
    • Nobody/Anonymous

      Thanks, I had the blank node problem as well as the visual designer throwing an error message, and this bit you wrote worked:

      NodeTextBox tb = new NodeTextBox();
      tb.DataPropertyName = "Text";
      treeViewAdv1.NodeControls.Add(tb);

      Cheers!

       
    • Nobody/Anonymous

      "The value "NodeTextBox" is not a type "Aga.Controls.Tree.NodeControls.NodeControl" and 
      cannot be used in this generic collection.
      Parameter name: value. "

      Restart Visual Studio to get it to work. (Will only work for a while, you have to restart again later)

       
  • Linda

    Linda - 2015-06-29

    I encountered the same problem also, and it is very hard to figure it out until I read this discussion. Thank you very much!

    BTW. Is there any documentation for the library?

     

Log in to post a comment.