SfDataGrid Pageup and PageDown Programatically
Hii,
Is It Possible To Achieve The Functionality Of KeyBoard PageUp anad PageDown Key Press on SfDataGrid Programatically
I am Working a Project,Where I Want To PageUp And PageDown SfDataGrid Data On Button Click
SIGN IN To post a reply.
3 Replies
JN
Jayaleshwari N
Syncfusion Team
January 10, 2019 12:18 PM UTC
Hi Yogendra,
Thanks for contacting Syncfusion Support.
We have analyzed the reported query “SfDataGrid Pageup and PageDown Programatically” from our side. You can achieve your requirement by raising the PreviewKeyDownEvent programmatically.
|
private void OnPageDown(object obj)
{
var dataGrid = obj as SfDataGrid;
if (dataGrid.SelectedIndex > -1)
{
var key = Key.PageDown;
if (dataGrid.SelectionController == null || dataGrid.SelectionController.CurrentCellManager == null || dataGrid.SelectionController.CurrentCellManager.CurrentCell == null)
return;
var targetElement = dataGrid.SelectionController.CurrentCellManager.CurrentCell.ColumnElement as GridCell;
var routedEvent = Keyboard.PreviewKeyDownEvent;
targetElement.RaiseEvent(new KeyEventArgs(Keyboard.PrimaryDevice, PresentationSource.FromVisual(targetElement), 0, key) { RoutedEvent = routedEvent });
}
}
private void OnPageUP(object obj)
{
var dataGrid = obj as SfDataGrid;
if (dataGrid.SelectedIndex > -1)
{
var key = Key.PageUp;
if (dataGrid.SelectionController == null || dataGrid.SelectionController.CurrentCellManager == null || dataGrid.SelectionController.CurrentCellManager.CurrentCell == null)
return;
var targetElement = dataGrid.SelectionController.CurrentCellManager.CurrentCell.ColumnElement as GridCell;
var routedEvent = Keyboard.PreviewKeyDownEvent;
targetElement.RaiseEvent(new KeyEventArgs(Keyboard.PrimaryDevice, PresentationSource.FromVisual(targetElement), 0, key) { RoutedEvent = routedEvent });
}
} |
We have attached the sample for your reference and you can download the same from the following location.
Please let us know if you would require further assistance.
Regards,
Jayaleshwari N
YO
yogendra
January 10, 2019 02:09 PM UTC
Thanks A Lot.
JN
Jayaleshwari N
Syncfusion Team
January 11, 2019 10:15 AM UTC
Hi Yogendra,
Thanks for the update. Please get in touch if you would require for further assistance.
Regards,
Jayaleshwari N.
SIGN IN To post a reply.
- 3 Replies
- 2 Participants
-
YO yogendra
- Jan 9, 2019 01:08 PM UTC
- Jan 11, 2019 10:15 AM UTC