Data Grid Scroll Bar

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How do I capture the position of the vertical scroll bar?

I present the grid to a user, they select an item, and I pop up an edit
window. When they are done, I need to refresh the grid (editing cell
contents of the grid is not an option here).

when I refresh the grid, the scroll bar is back at the top. I want it where
it was. I can capture the scroll event, but there doesn't seem to be a
property of the scroll bar for the position value.

Thanks in advance.

Ed
 
EdB said:
How do I capture the position of the vertical scroll bar?

I present the grid to a user, they select an item, and I pop up an edit
window. When they are done, I need to refresh the grid (editing cell
contents of the grid is not an option here).

when I refresh the grid, the scroll bar is back at the top. I want it where
it was. I can capture the scroll event, but there doesn't seem to be a
property of the scroll bar for the position value.

Thanks in advance.

Ed

I think the way to do that is to remember the DataGrid.CurrentRoxIndex.
Then after your refresh just set the DataGrid.CurrentRowIndex and it
will jump back down to that row.

Chris
 
Sounds to me like you need a SmartNavigation property for the DataGrid,
something like Internet Explorer supports.

You must be retrieving the Row Number of the Row, that was edited somewhere,
so have you tried the DataGrid.Select(RowNumber) method ? I believe that
when selected, the DataGrid would scroll down to that row, though I haven't
tried it. Let me know if it works.

If it doesn't, I guess you'll have to create your own implementation of the
DataGrid control, inheriting from System.Windows.Forms.DataGrid.

Regards,

Cerebrus.
 
yeah, that's the ticket, thanks.

Chris said:
I think the way to do that is to remember the DataGrid.CurrentRoxIndex.
Then after your refresh just set the DataGrid.CurrentRowIndex and it
will jump back down to that row.

Chris
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top