I have a datagrid in WPF with a DataGridTextColum and a DataGridTemplateColum.
Hisham's suggestion works perfectly for me, but I would use OnCurrentCellChanged instead, since OnSelectedCellsChanged will not work when the SelectionUnit is CellOrRowHeader. In the latter case BeginEdit() would only be triggered when selection moves to a cell in another row. Stepping left or right will not trigger the event at all.
Also, it is probably advisable to add a DependencyProperty to the custom control and check against it before triggering BeginEdit(), to prevent this behavior if so desired (as done by other DataGrids, such as XCeed). But this is not a critic - just something that I usually do.
protected override void OnCurrentCellChanged(EventArgs e)
{
// Make sure a cell is selected and only enter edit mode
// if this is the desired behavior
if (CurrentCell != null && EditTrigger == EditTriggers.CellsCurrent)
{
this.BeginEdit();
}
base.OnCurrentCellChanged(e);
}