Thursday, May 20, 2010

Bind Object to WPF TreeView

Programmer Question

I would like to know how to bind a custom datatype to a treeview.



The datatype is basically arraylists of objects that contain other arraylists. Access to would look something like this.



foreach (DeviceGroup dg in system.deviceGroups)
{
foreach (DeviceType dt in dg.deviceTypes)
{
foreach (DeviceInstance di in dt.deviceInstances)
{

}
}
}


I would like the treeview to look something like this:



DeviceGroup1



 --> DeviceType1
--DeviceInstance1
--DeviceInstance2
--> DeviceType2
--DeviceInstance1


DeviceGroup2



 --> DeviceType1
--DeviceInstance1
--> DeviceType2


Find the answer here

No comments:

Post a Comment

LinkWithin

Related Posts with Thumbnails