I need to mix different types of ViewStypes (Infragistics.Win.UltraWinTree.ViewStyle) on the different levels of a data source bound tree. I would like the top two levels within the tree (each level is a DataTable) to appear as a Standard tree node whist the bottom level to appear as a Grid (multiple Cells). This is the structure that I would like to get:
+ Level 1
+ Level 2
+ Level 3 Column1 | Level3 Column2 | Level 3 Column 3| ...
What is the easiest way to achieve something like that? If I start with tree ViewStyle Grid all levels within the tree appear as single or multi-cell grid levels. Thanks!
Mike, thanks for the quick response - overrides did the job just fine. One other question for the same tree. The datasource for the tree above is a dataset with 3 DataTables (one for each level) and 2 DataRelation linking the child nodes to corresponding parents (or vice versa). What I see is that when in VIewStyle.Grid mode - unlike when ViewStyle.Standard - the name for the Level 2 (2nd band) is not the name of the DataTable associated with the 2nd band and rather is the name of the DataRelation ("Level1_Level2" in this case). Therefore the tree shoes up like the following:
+ Level1_ Level 2
Curiously the name is correct for the Level1 and Level 3 and below. Is that a known behavior and what's the easiest way to get around it (just rename the DataRelation?). I need "Level 2" to be the name of the 2nd band. Thanks again!
The name of the band comes from the data source, and in the case of a DataSet, it's always the name of the Relationship. So I expect you are mistaken about the third level.
It also doesn't matter which ViewStyle you are using.
Where are you seeing the band names, anyway? Those will only show up if you have sibling bands and you don't have any in the example you describe here.
I see that the first band node ('Standard type node') is named correctly - ie. Level 1. 2nd Level node is named as I named DataRelation between 2nd and 1st bands - Level1_Level2 (as opposed to name of the 2nd band DataTable - Level 2).
For some reason even though I indicated 'ShowColumns =False' for 1st and 2nd level what I see (see your first response) this is the tree structure that I end up with:
+ Level 1 (1st Datatable name, standard node)
+ Level1_ Level 2 (Name of the relationship appears as a standard node)
+ Level 2 (2nd Datatable name, appears as a grid node)
+ Level 3 Column1 | Level3 Column2 | Level 3 Column 3| ... (3rd Datatable name, appears as a grid node)
I want to get rid of the Level1_ Level 2 (replace it with Level 2 DataTable name) and make Level 2 DataTable a standard node (right now it became a 3rd level node b/c of the relation). Any way to prevent Relation name to be shown on the tree at all? Thanks!
Hi,
Like I said, the tree only shows the band nodes (by default) if you have sibling node.
Maybe you set tree.ColumnSettings.ShowBandNodes to Always? The default is OnlyForSiblingBands.
Or perhaps there is another relationship directly under Level 1 which is therefore a sibling of Level1_Level2
Anyway, you can set the text of the band nodes to whatever you want. I'd recommend using the InitializeDataNode event:
private void ultraTree1_InitializeDataNode(object sender, Infragistics.Win.UltraWinTree.InitializeDataNodeEventArgs e) { if (e.Node.IsBandNode) { switch (e.Node.BandName) { case "Level1_Level2": e.Node.Text = "Whatever text I want."; break; } } }
Thanks Mike. My objective is to remove this band node alltogether, not just change its name. I will try to reproduce this behavior in a sample project and post it here if I cannot find a solution.
If you didn't change ShowBandNodes from the default, then your data source must have more than one relationship under Level 1. This is easy enough to check. Trap the ColumnSetGenerated event and loop through the columns in the Level 1 ColumnSet. Check each column's IsChaptered property. If there is more than one, then you have more than one child band. I think if you hide or remove all but one of the chaptered columns, the band nodes should go away.
Mike, I do have 2 relationships under Level 1. Since Level 1 has 2 child DataTables I have one relationship to parent table for each child table. Below is the complete structure of this tree. For each table in this structure I create a child-parent relationship.
+ Level 2a
+ Level 2b
I've included a sample project that demonstrates a similar behavior, one parent Datatable with two child DataTables and two relationships result in an extra set of sibling nodes. If I remove one of the relations (right now there a two, one for each child) only one of the child tables is shown. I cannot just create one child table and add two data rows into it. Although this would resolve this problem, in my case, each child table can has its own set of table specific columns. Therefore I need two child tables. Project code is included. This is the screenshot of the tree in the sample project.
Its quite clear now...Thanks for your help
I'm not sure where the point of confusion is here, but I will reiterate:
If you have sibling bands in the tree, the tree must show band nodes. There is no way around that. You cannot display sibling bands in the tree without band nodes.
I suppose you could manually populate the tree instead of using DataBinding and then assign a ColumnSet to each node. You would have to set the tree's ViewStyle to FreeStyle and this would mean that the column headers would show up on every node.
I understand the default behavior of the Tree control. My question is - is there a way to override it while preserving this structure? I know the sibling nodes can be hidden (so as the dotted lines) but this tends to screw up the way the tree looks, is there a cleaner way to remove these extra nodes? Thanks again.
Okay, so that's what I was saying. You have sibling bands. In a case like this, the tree has to separate the nodes collecttions in two groups - one for each child band. You cannot remove the Band Nodes in this case.