我正在使用 WPFDataGrid 控件,并希望Cell
通过单击将键盘焦点设置为选中。默认用户必须双击单元格才能开始编写。我尝试过的代码是:
<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>
当我单击一个单元格时,它会到达Editmode
,我需要再次单击以在此处设置键盘焦点并开始写作!