Hi,
I am also facing the same problem, Can anyone help us.......
arthi
Hello Arthi and Aziz,
The PageUp/PageDown keys are associated with respectively RecordFirstDisplayed/RecordPageAbove and RecordLastDisplayed/RecordPageBelow commands of the XamDataPresenter. As the XamDataGrid has no notion of page size (records displayed) you would have to control this manually. What you can do is to handle the ExecutingCommand event of the XamDataGrid and cancel these events and provide your custom logic. Below is a simple implementation of the suggested approach :
private void xamDataGrid1_ExecutingCommand(object sender, ExecutingCommandEventArgs e)
{
XamDataGrid grid = sender as XamDataGrid ;
int count = grid.GetRecordsInView(false ).Count(); // records per page
int index = grid.GetRecordsInView(false ).ToList<Record >().IndexOf(grid.ActiveRecord); // index of active record
if (e.Command == DataPresenterCommands .RecordFirstDisplayed)
// scroll up
grid.ScrollInfo.SetVerticalOffset(grid.ScrollInfo.VerticalOffset - count);
e.Cancel = true ;
}
if (e.Command == DataPresenterCommands .RecordLastDisplayed)
// scroll down
grid.ScrollInfo.SetVerticalOffset(grid.ScrollInfo.VerticalOffset + count);
// activate the new record based on the index of the previously active one
grid.GetRecordsInView(false ).ElementAt(index).IsActive = true ;