Say I have a TreeView of cars with different manufacturers, then a sub tree of models, etc. If I want each node to have a set of properties how would I do that? Would I make a new class and then assign each node to a class in some way? I'm having difficulty conceptualizing this but I imagine it is possible. What would be the point of a TreeView if you couldn't add data to each member?
In my right click menu for the carModelNode I have an option called properties. When the user clicks it it opens a form where the user then enters/edits data such as the year of the car, colour, manual/auto, etc. How can I then store that data and associate it with that node? Is there an easy way to do this or is this going to call for more of a jerry rigged approach?
**Please provide some examples with what you're talking about because I'm still not very good with syntax!
EDIT: my attempt below is for @Ed Plunkett
A class with the properties I want each node to have:
public class CarProperties
{
public string type = "";
public string name = "";
public int year = 0;
public bool isManual = false;
}
And now trying to assign these properties to a node:
CarProperties FordFocus = new CarProperties();
FordFocus.name = "exampleName";
...
treeIO.SelectedNode.Tag = FordFocus;
Does this look about right?