Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
170
how to resize child node columns width in an UltraTree
posted

I have two datatables that are linked using relation of a dataset. I have been able to resize the parent columns to handle the longest value.

However I cannot get the child to auto expand to the longest child.

      For Each col In UT1.Nodes(0).Cells
            col.Column.PerformAutoResize()
        Next

sets for the parent. but if I put

      For Each col In UT1.Nodes(1).Cells
            col.Column.PerformAutoResize()
        Next

Nothing happens. Can anybody let me know how to get the child node columns to be as wide as longest value

Parents
  • 25665
    Verified Answer
    Offline posted

    Hello Tom,

    Thank you for contacting Infragistics!

    UT1.Nodes(0) is the first root node. And UT1.Nodes(1) is the second root node. So neither of these will do anything to child nodes. It is also not best practice to use the cells collection to get the column.

    Either way if the tree is bound, it doesn’t load the child nodes until you expand the parent. So the best thing to do would be use the AfterExpanded event:

    Private Sub UltraTree1_AfterExpand(sender As Object, e As NodeEventArgs) Handles UltraTree1.AfterExpand
    Dim columnSet = e.TreeNode.Nodes.ColumnSetResolved
    If (Not columnSet Is Nothing) Then
    For Each column As UltraTreeNodeColumn In columnSet.Columns
    column.PerformAutoResize(ColumnAutoSizeMode.AllNodesWithDescendants)
    Next
    End If
    End Sub

Reply Children
No Data