I am using WPFDataGrid control and want to set keyboard focus to selected Cell by single-click.By deafault user must double-click cell to start writing.i’ve tried the code be:
<Style TargetType="{x:Type DataGridCell}" x:Key="DataGridCellStyle">
<Setter Property="IsTabStop" Value="True" />
<Setter Property="Focusable" Value="True" />
<Style.Triggers>
<Trigger Property="IsKeyboardFocusWithin" Value="True">
<Setter Property="IsEditing" Value="True" />
</Trigger>
</Style.Triggers>
</Style>
When i click on a cell,it get to Editmode,and i need to click again to set keyboard focus there and start writing!
I ‘m not sure if this a nice feature. You might not be able to select multiple cells. anyway handle
OnCurrentCellChangedeventBeginEdit()cause DataGridPreparingCellForEdit event to occure, I think you should handle that event:also, you can handle BeginningEdit event.