We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

SfDataGrid Pageup and PageDown Programatically

Thread ID:

Created:

Updated:

Platform:

Replies:

141883 Jan 9,2019 01:08 PM UTC Jan 11,2019 10:15 AM UTC WPF 3
loading
Tags: SfDataGrid
yogendra
Asked On January 9, 2019 01:08 PM UTC

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

Jayaleshwari N [Syncfusion]
Replied On 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 


yogendra
Replied On January 10, 2019 02:09 PM UTC

Thanks A Lot.

Jayaleshwari N [Syncfusion]
Replied On 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. 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;