Hi,
now after hours of searching I can't find a way to scroll an activ row to the center of the grid.
With arrowkeys I navigate through all cells, when pressing ENTER I let the grid sorting the appropiate column and "yes I can" scroll "ScrollRowIntoView".
ultraGrid1.ActiveRowScrollRegion.ScrollRowIntoView(ultraGrid1.ActiveRow);
But I can't scroll to the center of the grid.
Are there any samples or methods to do this?
Thx Nobbi
Hello Nobbi,
If you would like the ActiveRow to be in the middle of the visible window you could try setting it like the following:
private void ultraButton1_Click(object sender, EventArgs e) { int i = (int)Math.Floor((double)ultraGrid1.DisplayLayout.RowScrollRegions[0].VisibleRows.Count / 2); ultraGrid1.Rows[ultraGrid1.DisplayLayout.RowScrollRegions[0].FirstRow.Index + i-1].Activate(); }
If you would like to scroll the UltraGrid only you should determine what exactly would have to happen using something like the following:
ultraGrid1.DisplayLayout.RowScrollRegions[0].Scroll(Infragistics.Win.UltraWinGrid.RowScrollAction.LineDown); ultraGrid1.DisplayLayout.RowScrollRegions[0].ScrollPosition = determine where the scroll bar should be;
Please feel free to let me know if I missunderstood what you are asking here.
Hello Danko,
the first code comes close to that I'm looking for. Unfortunately it's not the active Row which is scrolled to the middle of the visble window. And afterwards I have the Rowselection activated, so I lost the focus of the certain cell.
I try to explain again.
I navigate with the arrowkeys through different Cells (up and down, right and left). When pressing ENTER the Grid sorts the column of the activated cell. Then I can make the still activated Cell visible. But the activated cell is generally not in the middle of the visible window of the grid. So I need code, which scrolls the activerow belonging to that cell to be in the middle of the grid (and not loosing the focus of my cell).
Please excuse my english
Greetings from Germany
Nobbi