DataGrid: how to disable a single cell?

Jul 16, 2013 at 6:21 PM
Hi all,
I have a DataGrid with
this.dataGrid1.SelectionMode = SourceGrid.GridSelectionMode.Row; 
and I need to disable from editing (with double click) a single cell.
I can disable an entire Column with
this.dataGrid1.Columns[0].DataCell.Editor.EnableEdit = false;
I tried to understand how to get the double clicked cell in a method like this
private void dataGrid1_DoubleClick(object sender, EventArgs e)
{
      //Get current Cell
      if (String.Compare(currentCell.Value, "SomeText" )==0)
       {
            //Do Something
       }
}
But I don't know how to do it. I looked into the examples but I didn't found anything that can help me.

Can someone explain how to do, please?
Jul 17, 2013 at 6:09 PM
Is this project still alive?

I tried also this, but I think there is a bug
 SourceGrid.Cells.Virtual.CellVirtual cl = (SourceGrid.Cells.Virtual.CellVirtual)this.dataGrid1.GetCell(1, 1);
 cl.AddController(SourceGrid.Cells.Controllers.Unselectable.Default);
I would expect that the controller is added only for the Cell at row[1] and col[1], but instead is applied to the entire column.

Anyone that can help me, please?
Sep 11, 2013 at 7:42 AM
Edited Sep 11, 2013 at 7:43 AM
Hello AlexComplex,

Maybe this could help you: SourceGrid.Cells.Cell has a Editor property (EditorBase CellVirtual.Editor or SourceGrid.Cells.Virtual.CellVirtual).
This property (SourceGrid.Cells.Editors.EditorBase) has some interesting properties:
  • EditableMode (AnyKey, Default, DoubleClick, F2Key, Focus, None, SingleClick) which deals with the way to start editing the contents of teh cell;
  • EnableEdit (bool) which blocks or allows editing.
So you can say, for example:
grid[row, column].Editor.EditableMode = SourceGrid.EditableMode.None; // will not start editing by any user action
or
grid[row, column].Editor.EditableMode = SourceGrid.EditableMode.Default; // default way to start editing this cell
grid[row, column].Editor.EnableEdit = false; // do not start editing at this moment
Kind regards,

Pieter