jdo*_*dot 6 c# wpf styles listboxitem inputbinding
我想右键点击左键点击命令添加到每个ListBoxItem中Style.这可能吗?
<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>
Run Code Online (Sandbox Code Playgroud)
我无法找到一种方法来实现我最初想要的。我最终使用事件而不是命令。
<Style TargetType="{x:Type ListBoxItem}">
<EventSetter Event="PreviewMouseLeftButtonDown" Handler="AssignItem"/>
<EventSetter Event="PreviewMouseRightButtonDown" Handler="RemoveItem"/>
</Style>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3028 次 |
| 最近记录: |