Easy object binding to Treeview Node

前端 未结 4 1114
北恋
北恋 2021-01-11 14:25

How can I bind an object to a treeview (Winforms) node in C#?

I thought of something like ExNode : Windows.Forms.Node that can take an object as member besides the t

4条回答
  •  时光取名叫无心
    2021-01-11 14:48

    This MSDN article has some good information, for example:

    class myTreeNode : TreeNode
    {
       public string FilePath;
    
       public myTreeNode(string fp)
       {
          FilePath = fp;
          this.Text = fp.Substring(fp.LastIndexOf("\\"));
       }
    }
    

提交回复
热议问题