By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,260 Members | 1,329 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,260 IT Pros & Developers. It's quick & easy.

Data Grid Scroll Bar

P: n/a
EdB
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


Feb 10 '06 #1
Share this Question
Share on Google+
3 Replies


P: n/a
EdB wrote:
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
Feb 10 '06 #2

P: n/a
EdB
yeah, that's the ticket, thanks.

"Chris" wrote:
EdB wrote:
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

Feb 10 '06 #3

P: n/a
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.

Feb 11 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.