.Net6 Flex Grid Scrolling on Selection with CellRange SelectionMode

Posted by: frugamas on 20 May 2022, 9:28 am EST

  • Posted 20 May 2022, 9:28 am EST

    I'm working with .Net6 Version of the FlexGrid, v6.0.20221.209.

    I'm trying to use the CellRange selection mode and I'm getting some un-wanted behavior. The behavior can be reproduced in the Selection Modes page in the FlexGridExplorer sample.

    To reproduce:
    - Click and select the first cell.
    - Scroll to the bottom of the table with the scrollbar.
    - Click on the cell for the Address column on the last row.
    - Unwanted behavior. The grid scrolls back to the top of grid.

    Is there a way to override the behavior, so that the grid does not scroll to the top?

    Thanks,

    Felix
  • Replied 22 May 2022, 8:22 pm EST

    Hi,

    We are unable to replicate this behavior at our end i.e., grid doesn't scrolls to top while selecting last cell of Address column which is correct behavior.

    Please refer the attached Gif for the same:


    Could you please provide a small stripped sample replicating this behavior. So, that we can assist you accordingly.

    Best Regards,
    Nitin
  • Replied 23 May 2022, 12:30 am EST

    Sorry Nitin, I left a crucial part in the description of the issue and steps.

    I'm trying to select continuous cell.

    To reproduce:
    - Click and select the first cell.
    - Scroll to the bottom of the table with the scrollbar.
    - Shift+Click on the cell for the Address column on the last row.
    - Unwanted behavior. The grid scrolls back to the top of grid.

    Felix



  • Replied 23 May 2022, 6:32 pm EST

    Hi Felix,

    Thanks for the detailed steps.

    We have reproduced this behavior at our end. This seems like a bug. So, that we have escalated it to the development team. We will get back to you once we have any update from them[Internal Tracking Id - C1XAML-29498]

    As a workaround, you can handle PreviewMouseDown event as:(see code snippet)


    private void Grid_PreviewMouseDown(object sender, MouseButtonEventArgs e)
    {
    if(Keyboard.Modifiers == ModifierKeys.Shift)
    {
    if (grid.SelectionMode == GridSelectionMode.CellRange)
    {
    var ht = grid.HitTest(e);
    if(ht!=null)
    {
    if(ht.CellType == GridCellType.Cell)
    {
    if (grid.CursorRange != null)
    {
    var r1 = grid.CursorRange.Row;
    var c1 = grid.CursorRange.Column;
    var r2 = ht.CellRange.Row;
    var c2 = ht.CellRange.Column;

    var row1 = r1;
    var row2 = r2;
    var col1 = c1;
    var col2 = c2;
    if(r1>r2)
    {
    row1 = r2;
    row2 = r1;
    }
    if (c1 > c2)
    {
    col1 = c2;
    col2 = c1;
    }
    grid.Selection = new GridCellRange(row1,col1,row2, col2);
    }
    }
    }
    e.Handled = true;
    }
    }
    }


    Please refer the attached sample for the same: FlexgridContinuousSelection.zip

    Best Regards,
    Nitin.
  • Replied 24 May 2022, 7:49 am EST

    Thanks Nitin.
  • Replied 4 August 2022, 2:08 am EST

    Hi,

    We are happy to inform you that, this issue is fixed in 2022v2 release.
    Please download the latest ComponentOne Control Panel from https://www.grapecity.com/componentone/download and install the latest 2022v2 build.

    Best Regards,
    Nitin.
Need extra support?

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

Learn More

Forum Channels