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
1105
ScrollCellIntoView to center screen
posted

Hi. my application let a user click somewhere and my xamDataGrid should change the selected row/active row accordingly.

I'm using ScrollCellIntoView to make the row visible to the user and it works.

however, this row appear sometimes in the top section and sometimes in the bottom section. I assume that it is related to how it is implemented, something like moving one row up or down until getting to that row.

This is unexpected behavior for my user, I would like to find a way to make it appear in the middle, can you suggest a way?

The code I'm using today is:

grid.SelectionSettings.SelectedRows.Clear();
grid.SelectionSettings.SelectedRows.Add(LogViewer.grid.Rows[rowIndex]);
grid.ScrollCellIntoView(LogViewer.grid.Rows[rowIndex].Cells[0]);

I have also tried to 'trick' the funtion by calling ScrollCellIntoView to 10 lines before, than 10 lines after and than the actual line, 
thinking this will cause it to appear in the middle, but it didn't do anything.

please help...
thanks.