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
2745
Problem when using ScrollRowIntoView
posted

Hello!

I have a grid in which I show messages. All messages have a date column and the rows are sorted according to date.

So we have old messages, messages that are for the future and we have "hot" messages which are to be shown today so to speak.

What I want to do is to scroll the grid automatically to get the first message today to appear in the top of the grid.

After a lot of reading in here within this topic, I still couldn't find a solution that worked.

So I am kindly asking for help.

What I have is a grid with many columns but all of them except one is hidden. I have changed the visible cell data using the editor component, and this is done in InitializeRow event.

I am binding the datasource when the form is loaded, and then I use the InitializeLayout for column changes and the InitializeRow for theeditor component work.

I also evaluate which row that should be in the top of the grid in InitializeRow event.

My problems are:

1. I have placed the ScrollIntoViewCode the row after the datasource binding. I get a timing problem the first time I run it since the row to be placed in the top isn't set. Where shall I place the code to functionally all the time. I have used both:

grdNotifications.ActiveRowScrollRegion.FirstRow = ActiveRow_Notifications
grdNotifications.ActiveRowScrollRegion.ScrollRowIntoView(ActiveRow_Notifications)

Which one is to prefer?

2. Secondly, when I have a row to scroll for, it looks like the rows are squezed together. 

I have set the row height to AutoFixed, but since I have a usercontrol as the editor component, it might be the problem. It looks like the grid returns to standard row height after the scrolling.

I have attached to images that might help out

Parents Reply Children
No Data