0

当用户输入“?”时,我正在尝试将键绑定添加到 wpf 数据网格上。并尝试了以下方法:

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

我也尝试过将键设置为“反斜杠”和“除法”。

有谁知道如何做到这一点?

4

1 回答 1

2

根据密钥枚举,它必须是OemQuestion

我厌倦了它并且它有效:

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

也许您有绑定问题?

于 2012-07-16T12:13:58.863 回答