Hi,
I have an issue with autosizing of UltraTree.
I have object with several properties bound to DataSource of some bindingSource. This binding source is bound to DataSource of UltraTree. In design mode I made all properties but one invisible. The tree generates just fine and looks simple:
- Text
When I use ViewStyle as Outlook Express and set:
ColumnSettings.AutoFitColumns = AutoFitColumns.ResizeAllColumns
the Tree looks as I expect and its width is expanded to parent Control.
Problem is with ViewStyle = Grid.
The tree is generated ok, but the width of the column is set to some default value. I could not find any property that says to column in node to expand so all text in cells are shown to the user.
Anyway I found some samples how to fix it with:
UltraTreeNodeColumn.PerformAutoResize();
And here comes the problem:
Now my tree looks fine, shows even longer texts, but also it shows Label. So I set:
UltraTreeColumnSet.LabelPosition = NodeLayoutLabelPosition.None;
And with this all resizing is gone. I was trying to set up various properties with various values but with no success.
Is there a way to do automatic column sizing in UltraTree with ViewStyle=Grid and no Labels displayed?
This sounds like a bug that was fixed a while back. You should dowload the latest service release and see if the problem is rectified, and if it isn't, log an incident or repost here with a sample project and we'll take a closer look.
Thanks for reply. I have tried service release but with no impact on tree behavior.
When I set LabelPosition = None PerformAutoResize is not working.
I have also noticed, that setting Column.LayoutInfo.PreferredCellSize does nothing, but using Column.LayoutInfo.PreferredLabelSize does the work.
And last thing, in OutlookExpress style everything is fine, but how can I set Image to last (not expandabel) node? There is default image (Collapsed), but when I click, image disappears. I was trying to put an image here but with no luck (Node.Cells[0].Appearance.Image = 0 and some variations). Code worked fine for any other node. I was able to put an image only into a cell. Laso LeftImages, RightImages did not work at all :(
Is it possible to add image to not expandable node in outlookexpress mode (so it is in line with collapsed and expanded node)?
kyso said:When I set LabelPosition = None PerformAutoResize is not working
That also works for me. OutlookExpress is ok with sizing. ViewStyle Grid is not ok with LabelPosition = None.
If I have time I post some sample here.
I'm having a similar problem. Any updates on this issue?
Thanks, Aaron
I'm using NetAdvantage 2008 V1 and had the same problem.I have found a working workaround for this problem I would like to share.
Just trap the 'AfterExpand' event and explicitly perform auto resize while 'LabelPosition' is in its 'Default' state. When done, set 'LabelPosition' back to 'None'.
private void myTree_AfterExpand(object sender, NodeEventArgs e) { var parent = e.TreeNode.Parent; if (null == parent) return; myTree.BeginUpdate(); myTree.ColumnSettings.LabelPosition = NodeLayoutLabelPosition.Default; foreach (var col in parent.Cells .Cast<UltraTreeNodeCell>() .Select(c => c.Column)) { col.PerformAutoResize( ColumnAutoSizeMode.AllNodesWithDescendants); } myTree.ColumnSettings.LabelPosition = NodeLayoutLabelPosition.None; myTree.EndUpdate(); }
Hope this helps!
Shay.