【发布时间】:2020-05-04 20:51:32
【问题描述】:
我目前正在尝试在删除数据网格行时将“delete”键绑定到Action。
设置KeyBinding 似乎不起作用:
<DataGrid.InputBindings>
<KeyBinding Key="Delete"
cal:Message.Attach="[Key Delete] = [Action DeletePartNumberRow()]"/>
</DataGrid.InputBindings>
将其设置为DataGrid,也不起作用:
<DataGrid x:Name="PartNumbers"
CanUserAddRows="True"
CanUserDeleteRows="True"
cal:Message.Attach="[Gesture Delete] = [Action DeletePartNumberRow()]">
...
</DataGrid>
我想知道是否有其他方法可以做到这一点,或者我是否尝试了错误的方式?
最终我希望能够在应用程序中创建自定义键绑定。我还有其他方法可以做到这一点吗?
【问题讨论】:
标签: wpf data-binding caliburn.micro