如何将添加键绑定添加到 DataGrid 列级别?
我有一个包含几列的 WPF DataGrid。现在我尝试将快捷键“Shift+$”添加到 DataGrid 列之一。我想要实现的是,当用户在特定列上时,然后按“Shift + $”,它会触发命令。如果用户在其他列上,“Shift + $”可以作为正常输入。
谁能告诉我如何实现这一目标?
谢谢静
I have a WPF DataGrid with few columns. Now i try to add the short cut key "Shift+$" into one of the DataGrid column. What I want to achieve is that when user on the partipular column, then press "Shift + $", it fire command. If user on other columns, "Shift + $" works as normal input.
Can anyone give me some idea how I can achieve this?
Thanks
Jing
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
数据网格列的选项有点有限,我尝试这样做:
不幸的是,这会抛出一个异常,告诉您 KeyGesture 不支持 Shift+D4。我想你的计划可能无论如何也无法实现......
The options are a bit limited with datagrid columns, i tried doing it this way:
Unfortunately this throws an exception telling you that Shift+D4 is not supported by KeyGesture. I think your plan might not work out anyway...