So we have a tree with a bound data set, several data tables showing like a Top level node and one child 'band' with cells. We bound the data set (tree1.SetDataBinding(ds, null), then user edits the value of one cell, we clear the column sets using tree1.ColumnSettings.ColumnSets.Clear(), re-build the data set and bind it again. We expand all nodes by default, so if I go and collapse any node(or click on the 'top level' node) in the tree control at this point, without selecting any nodes in the tree I get the following exception thrown apparently by Infragistics internal (see exception stack below).
There is one peculiarity that I noticed - if I first select one of the columns of the 'child' band - I see no problem from that point on until I repeat the change cell-rebind cycle...
We had this problem with tree version 8.2 and just upgraded to UT 9.2.20092.2017 with the same result. What could be causing something like that? Thanks!
See the end of this message for details on invoking just-in-time (JIT) debugging instead of this dialog box.************** Exception Text **************System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.Parameter name: index at System.Collections.ArrayList.get_Item(Int32 index) at Infragistics.Win.UltraWinTree.TreeNodeCellsCollection.GetCell(Int32 index) at Infragistics.Win.UltraWinTree.TreeNodeCellsCollection.get_Item(UltraTreeNodeColumn column) at Infragistics.Win.UltraWinTree.UltraTree.get_ActiveCell() at Infragistics.Win.UltraWinTree.UltraTreeNode.internalExpand(Boolean value, Boolean notify, Boolean updateVisibleNodes) at Infragistics.Win.UltraWinTree.UltraTreeNode.set_Expanded(Boolean value) at Infragistics.Win.UltraWinTree.UltraTreeNode.Toggle() at Infragistics.Win.UltraWinTree.ExpansionIndicatorUIElement.Toggle() at Infragistics.Win.ExpansionIndicatorUIElement.OnMouseDown(MouseEventArgs e, Boolean adjustableArea, UIElement& captureMouseForElement) at Infragistics.Win.ControlUIElementBase.ProcessMouseDownHelper(Object sender, MouseEventArgs e) at Infragistics.Win.ControlUIElementBase.ProcessMouseDown(Object sender, MouseEventArgs e) at Infragistics.Win.Utilities.ProcessEvent(Control control, ProcessEvent eventToProcess, EventArgs e) at Infragistics.Win.UltraControlBase.OnMouseDown(MouseEventArgs e) at Infragistics.Win.UltraWinTree.UltraTree.OnMouseDown(MouseEventArgs e) at System.Windows.Forms.Control.WmMouseDown(Message& m, MouseButtons button, Int32 clicks) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
Hello stuartdunlevy,
Could you please provide a small sample project with the steps needed to reproduce this issue. Also - which version of our controls exactly you are using? I will wait for your feedback and sample application.
I was experiencing the exact same ArgumentOutOfRangeException, which was being thrown by UltraTree.ActiveCell.
To work around this, I simply ensured that the ActiveCell was null, as soon as the UltraTree lost focus:
void
ultraTree1_LostFocus(object sender, EventArgs e){ ultraTree1.ActiveCell = null;}
This feels like a bug to me Infragistics. Please sort it out!
Actually, I read your response again and updated my force exit code as follows:
UltraTreeState state = tree1.CurrentState; if ((state & UltraTreeState.CellInEditMode) > 0) { tree1.PerformAction(UltraTreeAction.ExitEditMode, false, false); tree1.ActiveNode.Update(); tree1.ActiveCell = null; }
This seems to have resolved the exception....I hope that is sufficient to refresh grid internal state.
Basically, there is a tool strip button the user clicks to save the updated data. The tree cell update mode is set to OnLeaveCellOrLoseFocus which I understand is not fired when I press a tool strip button, is that correct? Before I save the data I execute the following block of code to force exit the edit mode:
UltraTreeState state = tree1.CurrentState;
if ((state & UltraTreeState.CellInEditMode) > 0){ tree1.PerformAction(UltraTreeAction.ExitEditMode, false, false); tree1.ActiveNode.Update();}
Right after I save the data I do tree1.DataSource = null, then clear the ColumnSets, build a new data set and rebind it to the tree control. Is there anything else I should do to prevent this exception? Thanks!
ExelonPowerteam said:What could be causing something like that?