I am using Telerik UI for Winforms version 2022.1.118.40
I am trying to bind a treeview to a list of object-related data, but only the root nodes are displayed.
My object-related data looks like this:
public class MyRootObject
{
public string Name {get; set;}
public List<MyChildObject> ChildObjects {get; set;}
}
public class MyChildObject
{
public string Name {get; set;}
}
My treeview is set up like this:
var myRootObjects = new List<MyRootObject>()
{
new MyRootObject()
{
Name = "RootName",
ChildObjects = new List<MyChildObject>()
{
Name = "ChildName"
}
}
}
MyTreeView.DataSource = myRootObjects;
MyTreeView.ChildMember = "ChildObjects";
I have tried different ways of setting the 'ChildMember' property, as per documentation ( https://docs.telerik.com/devtools/winforms/controls/treeview/data-binding/binding-to-object-relational-data ), such as 'myrootObjects\\ChildObjects', but I can not get the child objects to be displayed.
How do I get the child objects to be displayed?