i have object from class like this :
class student
{
private int st_ID;
private string name ;
private material[ mt;
}
class material
private int mt_ID;
private mark[ mk;
class mark
private int mk_ID;
now i recive object from student like this :
student [ ] std = new student[ ] { };
what i need to disblay in tree :
1- in first level the student name
2-in second level the material
3 in thired level the mark
remark : may be the student have mark may be not and may be have material and my be not
If you bind the tree to a List or BindingList of Student objects, then all you would have to do is add public properties that expose Lists or BindingList of the child objects (Marks and Materials).
thank you for replay ,but i am not undarstand can you explan the solution with example .
I tried copying your code into a new project and I had to make a small change to the InitLayoutTree2 method since the code you have here never defines the TreeList variable.
private void InitLayoutTree2() { TreeList treeList = new TreeList(); TreeListItem item = new TreeListItem("Overview Window"); treeList.Add(item); item.TreeListSubItems.Add(new TreeListSubItem("Overview 1")); item.TreeListSubItems.Add(new TreeListSubItem("Overview 2")); item.TreeListSubItems.Add(new TreeListSubItem("Overview 3")); treeListBindingSource.DataSource = treeList; }
But once I do that, it works fine for me. I see one parent and three child nodes in the tree. I'm attaching my sample (with your code in it) here. If this sample doesn't work for you, then my guess is you have an old version of the control and you need to get the latest hot fix.
I am very new to Infragistics and I have tried to to bind my data structure List<T> to WinTree control. WinTree does not display the hierarchical structure of my data.
My classes hierarchies are:
BaseConfiguration class has public Property to Set/Get Name as string
ConfigurationAttribute class has public Property to Set/Get Name as string and Value as string
ConfigurationElement class is a sub class of BaseConfiguration. It has public Property to Get List<ConfigurationAttribute> AttributeCollection
ConfigurationSection class is a subclass of BaseConfiguration. It has public Property to Get List<ConfigurationElement> GetConfigSectionCollection
ConfigurationSection
config = new ConfigurationSection();
config = xmlParser.Parse(readerType); // populate hierarchy data structure
UltraTree.DataSource = config.GetConfigSectionCollection;
This seems like it should work, as long as the properties you are referring to here are properties (not just members) and that they are public.
Are you creating any ColumnSets in the tree yourself? Or are you just leaving the tree to it's default settings and letting it create the ColumnSets automatically?
What exactly are you seeing in the tree? Which columns do you get?
My properties are public and they are not members.
No, I am not creating any ColumnSets.
I have changed the ultra tree view style to Grid.
Yes, I am leaving the tree to it's default settings.
The below picture shows the root node is not displaying the child nodes.
My earlier message post with two images used a different List object than the one I am trying to solve right now. I am sorry about that confusion.
Hi,
There are several reasons why this might happen.
1) Your configuration object does not expose a Public property which returns a list.
2) Such a property does exist, but at the time you are binding to the tree (when the ColumnSets are generated), the property is returning null and the BindingManager in cannot determine the structure of the child data.
If you bind this same data source to the WinGrid, does it show the child rows there?
If you could post a small sample project demonstrating this behavior, I could tell you exactly why it's not working.
Thank a million. There was nothing proprietary in the code. I feel better when my code is not floating around.
I have removed the attached sample for you.
In the future, if you are concerned about posting proprietary information, we can arrange for you to send your sample directly through developer support. But generally speaking, it's better not to include anything proprietary in a sample. :)
Thanks. I now understand.
How can I remove my previous post with the attached project?
Hi Jean-Claude,
Thanks for the sample.
I ran your sample, and I am getting the same results you describe. There's a tree with a single node and when I expand that node, there are no child nodes.
The first thing I did was put a WinGrid on the form and bind it to the same data source and I get the same results: a single row with no child rows.
So I look a look at the DataSource you are assigning to the Tree, which is the baseConfigList variable which is a List<BaseConfiguration>. Since you are binding to a list of the Base type, only the properties of the base type will be exposed by the BindingManager in DotNet.
The tree, the grid, or any other bound control has no control over this. This is the way DataBinding in DotNet works.
I thought you were binding to the derived types, which is why I was confused about why this was not working.
I have attached the zip file.
Jean-Claude