键绑定到'?'

时间:2012-07-16 09:21:04

标签: wpf datagrid key-bindings

我正在尝试在用户输入'?'时将键绑定添加到wpf数据网格中并尝试了以下内容:

<DataGrid.InputBindings>
            <KeyBinding Command="{Binding Path=OpenPrompt}" CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid}, Path=CurrentCell}" Key="OemBackslash" Modifiers="Shift"/>
</DataGrid.InputBindings>

我也尝试将密钥设置为'反斜杠'和'分割'。

有谁知道怎么做?

1 个答案:

答案 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>

也许你有一个绑定问题?

相关问题