我正在尝试在用户输入'?'时将键绑定添加到wpf数据网格中并尝试了以下内容:
<DataGrid.InputBindings>
<KeyBinding Command="{Binding Path=OpenPrompt}" CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid}, Path=CurrentCell}" Key="OemBackslash" Modifiers="Shift"/>
</DataGrid.InputBindings>
我也尝试将密钥设置为'反斜杠'和'分割'。
有谁知道怎么做?
答案 0 :(得分:2)
根据Key Enumeration,它必须是OemQuestion
我累了,它有效:
<DataGrid.InputBindings>
<KeyBinding Command="{Binding Path=MyCommand}" CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid}, Path=CurrentCell}" Key="OemQuestion" Modifiers="Shift"/>
</DataGrid.InputBindings>
也许你有一个绑定问题?