gpt4 book ai didi

wpf - 如何将输入键绑定(bind)到wpf中的itemscontrol

转载 作者:行者123 更新时间:2023-12-02 05:33:57 24 4
gpt4 key购买 nike

我有一个项目控件,它在 Canvas 上有项目,当我按删除键时,我想从 Canvas 中删除一个项目:

<ItemsControl.InputBindings>
<KeyBinding Command="{Binding DeleteItemCommand}" Key="Delete"/>
</ItemsControl.InputBindings>

但是,永远不会调用 DeleteItemCommand 中的方法。

我怎样才能做到这一点?

最佳答案

ItemsControl(或者可能是其中的某个东西)需要是 Focusable接收键盘输入。

关于wpf - 如何将输入键绑定(bind)到wpf中的itemscontrol,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11970921/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com