I'm having an issue with my WinTree. I have an object being used as the data source. This object has a property which is a collection of itself. The object is used to represent a category. Therefore, the child collection would be 2nd level sub categories. In my case, I need this to be 3 levels deep. This means that each child object in the parents' subcategory collection can also have a collection which would represent the 3rd level categories. When I bind my object, which is a collection of parent categories, who may or may not have 2nd level categories as well may or may not have 3rd level categories. When this tree gets rendered, I'm only able to expand to the 2nd level. There are no 3rd level categories rendered. The following are the properties I have changed on the UltraTree:
AllowDrop = True ColumnSettings.BorderStyleCell = Infragistics.Win.UIElementBorderStyle.None ColumnSettings.BorderStyleColumnHeader = Infragistics.Win.UIElementBorderStyle.None ImageTransparentColor = System.Drawing.Color.Transparent Location = New System.Drawing.Point(12, 12) Name = "treeProductCategories" NodeConnectorColor = System.Drawing.SystemColors.ControlDark Override1.BorderStyleNode = Infragistics.Win.UIElementBorderStyle.None Override = Override1 Size = New System.Drawing.Size(377, 391) TabIndex = 9 ViewStyle = Infragistics.Win.UltraWinTree.ViewStyle.OutlookExpress
Additionally I am handling the ColumnSetGenerated event only to set the following:
e.ColumnSet.LabelPosition = Infragistics.Win.UltraWinTree.NodeLayoutLabelPosition.Top
I am using NetAdvantage for Windows Forms 2011.1 CLR2. Given the above, is there any reason why the 3rd level categories would not render? Also, as another problem, if I use the ColumnSetGenerated event to iterate over the columns and remove the ones I don't want displayed, no children are displayed at all. Any help you may provide is greatly appreciated.
Thanks,
Nick
Hi Nick,
This might be a problem with your data source. The data structure in the tree is determined by the BindingManager in DotNet. If you have an object that returns a property which is of type IList or IBindingList, then the way the BindingManager gets the structure is by looking at the current item in the list. This is usually the first item.
So let's say you bind the tree to a list and that list has a few root-level items in it. From that, the tree can determine the structure of the data at the root level. It then walks down to the second level under the first root item and tries to get the structure of the second level from that. Then it looks for a child of that item to determine the structure of third level.
If is so happens that it hits an item that has no children, it cannot determine the data structure for that level and it assumes that there is no data at that level for ANY nodes. In other words, the entire data structure is based on the first root item, it's first child, the first child of that child, etc.
That's one reason why the behavior you describe might occur, anyway. How many times is the ColumnSetGenerated event firing? Is the tree creating a new ColumnSet for each level, or it is using one ColumnSet for the whole tree?
njtrentacoste said:if I use the ColumnSetGenerated event to iterate over the columns and remove the ones I don't want displayed, no children are displayed at all.
The child band is represented in the ColumnSet by a column. So you are probably removing the child band column without realizing it. Check the IsChaptered property of the column. If IsChaptered is true, then the column represents a child band and you probably don't want to remove it.
Mike,
Thanks for your response. For the answer about the tree depth, I had read that in the Infragistics documentation somewhere, and looked into that. What I found was that while there may not always be a 2nd or 3rd level node, the very first node (aka the first object in the collection) DOES have 3 levels of categories. So, I'm not sure what could be going on. Maybe the tree is grabbing a different object out of the collection first and it does not have the 3rd level. Either way, because of this functionality, it really prevents me from the Ronco method, set and forget, of binding to the tree. I cannot impose a requirement for there to be 3 or even 2 levels on everything. So I guess now, I'm looking for suggestions that would not have me manually building the tree.... :D. Any ideas?
As for the second part of my question, your answer was dead on! I added the check and now my desired columns are the only ones shown and I can expand them. Thanks again for your help on this!