|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Data Grid Scroll BarHow 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 wrote:
Show quoteHide quote > How do I capture the position of the vertical scroll bar? I think the way to do that is to remember the DataGrid.CurrentRoxIndex. > > 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 > > > > Then after your refresh just set the DataGrid.CurrentRowIndex and it will jump back down to that row. Chris yeah, that's the ticket, thanks.
Show quoteHide quote "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 > 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. |
|||||||||||||||||||||||