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
UltraWinTree range select not working after changed by code

Version 15.1.20151.2230 of UltraWinTree, VB2012:

With selection mode Extended, if I manually select a node, then use code to add a new node and select it, subsequent manual range selection malfunctions as if the original node is still selected.

Here is the entire code. Click node "ABC". Click "Button1", which adds node "WWW" and selects it and makes it active. Now hold shift and click node "JKL". Instead of selecting the range "WWW" to "JKL", it selects "DEF" to "JKL", as if the original node was still selected. Tried everything I could think of but can't fix this behavior:

Imports Infragistics.Win.UltraWinTree

Public Class Form1

Private Sub Form1_Load(sender As Object, e As EventArgs) Handles Me.Load

With UltraTree1

.HideSelection = False

.Override.SelectionType = SelectType.Extended

.Nodes.Add(1, "ABC")

.Nodes.Add(2, "DEF")

.Nodes.Add(3, "GHI")

.Nodes.Add(4, "JKL")

.Nodes.Add(5, "MNO")

End With

End Sub

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click

With UltraTree1

Dim lnodNew As UltraTreeNode = .Nodes.Add(999, "WWW")


lnodNew.Selected = True

.ActiveNode = lnodNew

End With

End Sub

End Class

  • 28910
    Verified Answer
    Offline posted

    Hello John,

    I have been investigating into this issue, and it appears that the reason that the selection is not working correctly is because the "pivot" item of the UltraTree is not being set when you programmatically change the selection in your tree. In order to change this "pivot" item, I would recommend casting your UltraTree to an ISelectionManager and calling the SetPivotItem to your desired tree node. For example, you could use the following code at the end of your Button click to achieve this:

    TryCast(UltraTree1, ISelectionManager).SetPivotItem(lnodNew, False)

    I hope this helps. Please let me know if you have any other questions or concerns on this matter.

Reply Children
No Data