Treeview Customization

  • Thread starter Thread starter Waleed Seada
  • Start date Start date
W

Waleed Seada

Hi all
I want to build a treeview class that will add some other properties for
each node, like pathtype, kind, etc...
What is the best way to do this, Illustration will be great

Thanks in advance
Waleed Seada
 
Waleed,

Before you start creating, did you try to reach your goal by setting an
object in the treenode.tag property?

Just my thought,

Cor
 
Does these extra properties store data about the node?
If so, you can use the NodeData property (string) to put in it the values
you want and extract them from the string whenever needed

Regards
Mohamed El Ashmawy
MEA Developer Support Center
ITWorx on behalf of Microsoft EMEA GTSC
 
Hi all
What I want is to build my Custom Treeview control, for future also,
I need to be able to apply changes to all my treeview in any build
application (as I Hope)

So, yes I want to add more information than the tag, yes i can use the
NodeData to store the Data separated by a dilimeter (I used to do this
in Power builder treeview)
But is there any easy way to implement this in CSharp, any how in Code
please, I mean defining the Treeview itself and the use of it

Note:
I am new to CSharp

Waleed Seada
 
Waleed said:
I want to build a treeview class that will add some other properties for
each node, like pathtype, kind, etc...
What is the best way to do this, Illustration will be great

You don't have to add TreeNode instances to a TreeView - you can add
instances of classes that descend from TreeNode, like

public class PathNode: TreeNode
{
public PathType PathType; // or whatever
}

This is generally better than using the Tag field:

1) Your fields and/or properties can be strongly typed, so you don't
have to cast to the right type before using them (and you can't store
the wrong type of data).

2) You have much less chance of unrelated code putting something else
on top of your pathtype or kind.
 
Thanks for yor post, I am a little bit confused, should I use the
Project->insert->usercontrol, then I change the usercontrol to whatever
control name I want, or there is another way to do this


Thanks and best regards
Waleed Seada
 
Okay, thanks Guys I did it, now I am on the first step in my class
library, I have added all the controls I need to work with now in a
separate library {treeview, buttons, ..}

Next step will be to add Methods and Properties to each of this control,
What is the best way to implement that ...

Thanks and best regards
Waleed Seada
 
Back
Top