Hi all i'm using a ultratreeview with viewstyle = freeform , i need to show large text in a column cell, i want the cell is fixed witdh and autosize height, this is my code but the cell don't size automatically:
UltraTreeColumnSet columnSet = new UltraTreeColumnSet(); UltraTreeNodeColumn info = columnSet.Columns.Add("info"); info.Text = "Descrizione"; info.CellWrapText = Infragistics.Win.DefaultableBoolean.True; info.AutoSizeMode = ColumnAutoSizeMode.VisibleNodes; info.LayoutInfo.PreferredLabelSize = new System.Drawing.Size(80, 20); info.LayoutInfo.PreferredCellSize= new System.Drawing.Size(80, 50); info.DataType=typeof(string); utvScadenze.NodeLevelOverrides[3].ColumnSet=columnSet;
...... Laod Tree.....
Handling resizing withing OnAfterDataNodesCollectionPopulate did the job however I did not find AutofitColumns property within the ColumnSet. Could it be named differently in 9.2? Thanks.
exelonbsc said:Is there any way to make sure the columns band occupies the entire visible area of the control though (width)
There's an AutoFitColumns property on the ColumnSet.
exelonbsc said:What is a good place to make sure top band columns are auto-sized once the grid appears?
I think if you use the OnAfterDataNodesCollectionPopulated event, you can take care of both the parent and child nodes in one place.
Mike, you are correct, that code did not quite make sense so I modified it to something like this:
That did the trick with auto-sizing so that cell text shows completely. Is there any way to make sure the columns band occupies the entire visible area of the control though (width) - there's still some space between the right edge of the hosting control and the right-most column.
Also, code above auto-sizes child band columns. What is a good place to make sure top band columns are auto-sized once the grid appears? I tried forcing Columnset.Columns to PerformAutoResize within tree_ColumnSetGenerated() handler but no sizing is done.
Thanks.
Hi,
I'm not sure I follow what you are trying to do with this code. You say this is in the AfterExpand event, but you are looping through the cells of the parent node, which seems odd. It would seem to me to make more sense to autosize the child node columns rather than the parent node - which was already visible before the expansion.
Not to hijack this thread but I have a related question. My ViewStyle=Grid, I am performing auto sizing each column on expansion by doing something like this in tree_AfterExpand()
foreach (UltraTreeNodeCell cell in parent.Cells)
{ cell.Column.PerformAutoResize(
Infragistics.Win.UltraWinTree.ColumnAutoSizeMode.VisibleNodes);}
however when the grid shows I see that the tree 'grid' does not occupy the entire width of the hosting control and it does not appear as though each cell expanded wide enough to display the text inside (whilst there's plenty of space left). Is there anything else I should do? Thanks.