I'm changing the default behaviour of the RadGridView so that pressing delete does not delete the row but instead clears the selected cells content (excel style behaviour), i've also remapped delete to shift+delete. Everything is working fine, except for the fact that i can't seem to be able to clear the current cell programmatically. Here is the code in my custom command (simple 1.st ver):
private void ClearCurrentCell(object obj)
{
if (_grid.CurrentCell == null)
return;
bool wasInEditMode = _grid.CurrentCell.IsInEditMode;
if (!wasInEditMode)
_grid.CurrentCell.BeginEdit();
_grid.CurrentCell.Value = null;
if (!wasInEditMode && _grid.CurrentCell.IsValid)
_grid.CurrentCell.CommitEdit();
}
But the cell revers to the bound value upon commit. How can I achieve this effect? Remember that I don't know the type of datasource bound to the cell.
private void ClearCurrentCell(object obj)
{
if (_grid.CurrentCell == null)
return;
bool wasInEditMode = _grid.CurrentCell.IsInEditMode;
if (!wasInEditMode)
_grid.CurrentCell.BeginEdit();
_grid.CurrentCell.Value = null;
if (!wasInEditMode && _grid.CurrentCell.IsValid)
_grid.CurrentCell.CommitEdit();
}
But the cell revers to the bound value upon commit. How can I achieve this effect? Remember that I don't know the type of datasource bound to the cell.