Hi,
In our application, we need to select a record , open a context menu (often launch a new window) and have lots of data process. After close the new window, usually we'd reset the datasoucre for the xamdatagrid due to revised data.
After that the hightlighted record is missing. It's very hard for us to know which record I have processed. Is it OK just save the selected record and recover? Or have other better way?
Thanks a lot.
HI,
We had the same issue.
Here is the closest solution we could find and implement. Hoe it helps you too.
Declare a local variable:
private double gridVerticalScrollPosition = 0;
Now just before you reload your datasource and rebind your grid:
if (grdData.ScrollInfo != null) gridVerticalScrollPosition = grdData.ScrollInfo.VerticalOffset;
Now your grid's scroll position is saved.
After your has been re binded to your updated datasource.
if (grdData.ScrollInfo != null) Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.ApplicationIdle, (System.Threading.ThreadStart)delegate { grdData.ScrollInfo.SetVerticalOffset (gridVerticalScrollPosition); });
this will scroll your grid back to the previous scroll position.
Hope this is acceptable