Clear Active Cell

Posted by: john.russell on 16 April 2021, 3:02 am EST

  • Posted 16 April 2021, 3:02 am EST

    I have an older version of the WPF Spread Sheet control - 1.0.4.0.

    I can move the active cell selection to wherever I want, but I can't seem to clear it when I don't want there to be an active cell selection... It seems there always has to be an active cell selection...

    I want to create a "read-only" view of my Spread Sheet control, but there's always the active cell selection.

    I've tried sheet.ClearSelections, setting ActiveCell to null, ActiveRowIndex, ColumnIndex -1, etc. Nothing will make this selection go away!

    Help!

    See screen capture for example.
  • Replied 18 April 2021, 11:40 pm EST

    Hi,
    This is the design behavior of Spread sheet to select at least first cell.
    However, you can achieve your requirement using the below workaround. Please use the below steps and shifting your design one column right:

    1. Set the selection color as transparent in window's Loaded Event:
    gcSpreadSheet1.ActiveSheet.SelectionBorderColor = Colors.Transparent;
    gcSpreadSheet1.ActiveSheet.SelectionBackground = Brushes.Transparent;

    2. Hide the first column in window's Loaded Event:
    gcSpreadSheet1.ActiveSheet.SetActiveCell(-1, -1);
    gcSpreadSheet1.ActiveSheet.Columns[0].IsVisible = False;

    3. Always set the selection on first cell in SelectionChanging Event
    gcSpreadSheet1.ActiveSheet.ClearSelections();
    gcSpreadSheet1.ActiveSheet.SetActiveCell(-1, -1);

    Hope, this will solve your issue.

    Thanks,
Need extra support?

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

Learn More

Forum Channels