在样式中定义输入绑定
我想为 Style
中的每个 ListBoxItem
添加右键单击和左键单击命令。这可能吗?
<Style TargetType="{x:Type ListBoxItem}">
<Setter Property="InputBindings">
<Setter.Value>
<MouseBinding Command="{x:Static View:Commands.AddItem}"
MouseAction="LeftClick"/>
<MouseBinding Command="{x:Static View:Commands.RemoveItem}"
MouseAction="RightClick"/>
</Setter.Value>
</Setter>
</Style>
I would like to add a right click and left click command to each ListBoxItem
in a Style
. Is this possible?
<Style TargetType="{x:Type ListBoxItem}">
<Setter Property="InputBindings">
<Setter.Value>
<MouseBinding Command="{x:Static View:Commands.AddItem}"
MouseAction="LeftClick"/>
<MouseBinding Command="{x:Static View:Commands.RemoveItem}"
MouseAction="RightClick"/>
</Setter.Value>
</Setter>
</Style>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我无法找到一种方法来实现我最初想要的。我最终使用事件而不是命令。
I was not able to find a way to accomplish what I originally wanted. I ended up using Events instead of Commands.