I have two level treeview with grid look. When clicking on the parent row it needs to expand and make sure children nodes are in the view of the screen.
This works fine until user scrolls away and first element is not visible anymore. At that point if user tries to clicking on different parent node he get an error (screenshot attached):
"Index was out of range. Must be non-negative and less than the size of the collection.Parameter name: index"
Usually the error happens if child item of ParentA node active/seletected, and User Clicks on ParentB node. As soon as the Expanded or BringIntoView triggers, It errors out
I tried to refresh treeView, and put delay. Seemed to work at first but now I see it still happening. We're using version 12.1. Please help. The source code below
Dim prevNode As UltraTreeNode = Nothing
....
Private Sub tvOrders_AfterSelect(ByVal sender As System.Object, ByVal e As Infragistics.Win.UltraWinTree.SelectEventArgs) Handles tvOrders.AfterSelect
.....
If e.NewSelections.Count > 0 Then If TypeOf e.NewSelections(0).Tag Is SCE.SCEInterfaces.IOrder Then tvOrders.Refresh() Application.DoEvents() If prevNode IsNot Nothing AndAlso prevNode IsNot e.NewSelections(0) Then prevNode.Expanded = False End If e.NewSelections(0).Expanded = True If e.NewSelections(0).Nodes.Count > 0 Then e.NewSelections(0).Nodes(0).BringIntoView(True) Else e.NewSelections(0).BringIntoView(True) End If _ActiveOrder = DirectCast(e.NewSelections(0).Tag, SCE.SCEInterfaces.IOrder) _selectedItem = Nothing prevNode = e.NewSelections(0) Else _ActiveOrder = DirectCast(e.NewSelections(0).Parent.Tag, SCE.SCEInterfaces.IOrder) _selectedItem = DirectCast(e.NewSelections(0).Tag, SCE.SCEInterfaces.IOrderItem) prevNode = e.NewSelections(0).Parent End If End If
End Sub
it crashes on my machine .. every time .. is there a number i can call .. i can get you a remote access so you can play on with it on my pc.?
Hello Nick,
Please take a look at the attached video because I have to be missing something. I am using 12.1.2038 in this sample.
1 - expand parent row 3
2 - highlight first child inside parent row 3
3 - scroll down so all children from parent row 3 are not visible anymore
4 - click on any row, before new row expands - ERROR
when scrolling down .. make sure that child of row 3 is still active/selected
I tried many times to reproduce the issue, I succeeded twice but was not able to get the exact steps to reproduce. Could you please explain to me step by step what I need to do in order to get this behavior every time so I could examine it?
Thank you!
here it is