Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
160
XamGrid disable cell navigation
posted

Hello,

I have a XamGrid with editing turned off, CellClickAction="SelectRow", CellSelection="None", RowSelection="Single". This all works fine as expected using the mouse.

However, navigating with the arrow keys still highlights cells within a row. Likewise, ctrl + end/home goes to the last/first cell in the row.

How can I completely disable all cell navigation within the row, and keep only vertical navigation, that is up/down/page up/down/home/end?

Thanks in advance.

Parents
  • 18204
    Verified Answer
    Offline posted

    Hello Cosmin,

    Thank you for posting in our forums!

    You can customize the keyboard navigation by handling the XamGrid's PreviewKeyDown event.  You can check for which keys are pressed and set the e.Handled to true to prevent the grid from processing the key press.

    The below example shows how you can prevent the left and right keys from activating the previous/next cells.  You can add additional logic for the Home/End buttons depending on your requirements.

    private void XamGrid_PreviewKeyDown(object sender, KeyEventArgs e)
    {
        e.Handled = (e.Key == Key.Left || e.Key == Key.Right);
    }

    If you have any further questions or concerns with this, please let me know.


    Sincerely,
    Michael H.
    Software Developer
    Infragistics, Inc.
    www.infragistics.com/support

Reply Children
No Data