We want to add a new row under the selected row.
We do it (roughly) with the following code:
int index = this.Grid.Selected.Rows[0].Index; UltraGridRow row = this.Grid.DisplayLayout.Bands[0].AddNew(); row.ParentCollection.Move(row, index + 1);
This works fine except the grid is scrolled to the end. In longer grids, the added row remains outside the visible region.
Is it possible to add a new row under the selected row and still keep the selected row and the added row within the visible region?
PS: The solution proposed here is not an option for us.
Hi, When you call AddNew, the newly-added row is scrolled into view. Since the row is always added at the bottom of the grid, the grid scrolls to the bottom.Then when you move the row, you are moving it out of view. So the simple solution is to just scroll that row back into view. this.Grid.ActiveRowScrollRegion.ScrollRowIntoView(row);
Thank you for the answer, Mike.
This solves my problem.
Two remarks:
Infragistics' help files indexed by Google return 404's lately. For example: http://help.infragistics.com/Help/NetAdvantage/WinForms/2012.2/CLR4.0/html/Infragistics4.Win.UltraWinGrid.v12.2~Infragistics.Win.UltraWinGrid.UltraGridColumn~FilterOperandStyle.html Will they be online again? Or shall we look for an alternative way of accessing your help files?
The GUI elements of the Infragistics' forums aren't rendered correctly (though still readable and comprehensible).