Position last change in Viewable area

Sep 4, 2008 at 5:16 PM
Edited Sep 4, 2008 at 5:18 PM

I have an application where the datagrid's data may be several pages long. When a new row is added programitically the data is re-sorted in the grid.  This makes the row easy to find alphabetically (if the user knows the sort method), but very difficult to locate in many displayed pages. One cloumn in my grid data is a boolean called LastCluster, it's true when the row(s) is the most recently added or edited.
 
To assist the user in locating the row(s), I use the boolean to overide the alternating colors in one column and set the background to a distintive color on rows that contain "True" in the LastCluster value.

Still - -  it is difficult for the user to quickly find the most recent data.  So, I would like to move the first row that has a true value in the LastCluster column so that it is the third row from the top in the viewable area of the datagrid. (the third row allows the user to see the new data in perspective to the data rows that preceeded it).  Could you suggest a code snippet that would allow a Boolean value in a row to move the Vertical Scroll Bar to position the new (or changed) data in the viewable area of the datagrid.

 

Coordinator
Sep 8, 2008 at 5:43 PM
You can possibly use DataGrid.ScrollIntoView(rowItem).  If you want it to be the third one down you can just subtract it like this, DataGrid.ScrollIntoView(DataGrid.Items[index -3]).  Of course you will need to handle the case for the bounds.  Hope that helps.
Sep 11, 2008 at 7:00 PM
Vince,

I am not sure what you mean by handleing the case for bounds. Perhaps a snippet would help.

BTW- Today I loaded the DataGrid with some rather large files and found a fairly significant performance problem. Page Scrolling is terribly slow.  In additon if you attempt to move the thumb of the scroll bar by click and drag, it is so slow that at first I thought that it was not working.  Everything was fine in small files but scrolling is downright awful in large files.
If need be I will be happy to post this as a seperate item because it really needs attention.

Bob
Coordinator
Sep 11, 2008 at 7:55 PM
I just mean the bounds of the index.  For example DataGrid.Items[-1] would throw an exception.