I am trying to populate a OutlookExpress-style WinTree from a DataSet and have all columns sized so that without any resizing by the user, when all nodes are expanded, nothing is abbreviated with ellipses.
1. Is this possible?
2. Why does .ColumnSettings.ColumnAutoSizeMode = AllNodesWithDescendants not work like I am expecting?
For example, in a new form with only an UltraWinTree on it:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim ds As New DataSet Dim dt As DataTable = ds.Tables.Add("tbl") dt.Columns.Add("text", GetType(String)) Dim colKey As DataColumn = dt.Columns.Add("key", GetType(Integer)) Dim colParent As DataColumn = dt.Columns.Add("parent", GetType(Integer)) ds.Relations.Add("recursive", colKey, colParent) dt.Rows.Add("one one one one", 1, DBNull.Value) dt.Rows.Add("two two two two", 2, 1) dt.Rows.Add("three three three", 3, 2) dt.DefaultView.RowFilter = "[parent] is null" UltraTree1.ViewStyle = Infragistics.Win.UltraWinTree.ViewStyle.OutlookExpress UltraTree1.ColumnSettings.HeaderStyle = Infragistics.Win.HeaderStyle.Standard 'UltraTree1.ColumnSettings.ColumnAutoSizeMode = Infragistics.Win.UltraWinTree.ColumnAutoSizeMode.AllNodesWithDescendants UltraTree1.DataSource = dt.DefaultView UltraTree1.ExpandAll(Infragistics.Win.UltraWinTree.ExpandAllType.OnlyNodesWithChildren) End Sub
Double-clicking to auto-size the first column makes it the width that I want it to be. (I am not opposed to expanding all nodes, auto-sizing the columns, and collapsing them all again, but I haven't been able to find a way to trigger the auto-sizing.)
However, if I uncomment the AllNodesWithDescendants line, the same double-click resizes to fit only the first cell. I would expect it to behave as the previous example does, except that even unexpanded rows would be considered when doing the autosize.
Descendants of collapsed nodes are not included when determining the column width; they are intentionally excluded because they are not visible. You can programmatically atuo-size a column by calling the column's 'PerformAutoSize' method.