Flexgrid navigation cells

Posted by: kisar on 11 April 2021, 9:14 pm EST

    • Post Options:
    • Link

    Posted 11 April 2021, 9:14 pm EST

    Hi

    Im working with a flexgrid in input mode,

    • I want to move Horizontal > C1.WPF.FlexGrid.KeyAction.MoveAcross
    • I set some columns to be readonly

    I would like to move with the Tab only between the editable cell

    (I would like to jump the cells in the column readonly)

    Is it possible, I did not find a way.

    Is is possible to select a specific cell?

    Thanx

  • Posted 11 April 2021, 10:40 pm EST

    Hi Kisar,

    In order to navigate only to the editable cells you can use FlexGrid’s PreviewKeyDown event as follows:

    private void FlexGrid_PreviewKeyDown(object sender, KeyEventArgs e)
    {
         if (e.Key == Key.Tab && flexGrid.Columns.Any(x => x.IsReadOnly == true))
         {
               var range = GetNextEditableCell(flexGrid.Selection.Row, flexGrid.Selection.Column);
    
               if(range.HasValue)
               {
                    flexGrid.Select(range.Value, true);
                    e.Handled = true;
               }
          }
    }
    

    JFYI, you can use FlexGrid’s Select method to select a specific cell.

    Please refer to the attached sample for full implementation. (see FlexGridNavigation.zip)

    Best Regards,

    Kartik

    FlexGridNavigation.zip

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels