![](/img/trans.png)
[英]How to catch mouse movement when left mouseButton is pressed on a button control and released on different button control?
[英]How can I trigger an event when the left mouse button gets released in WPF?
我需要在释放鼠标左键时触发事件。 我试过这个:
<i:Interaction.Triggers>
<i:EventTrigger EventName="MouseClick" >
<i:InvokeCommandAction Command="{Binding OnBarGroupChangeCommand}" CommandParameter="{Binding ElementName=ReportsBarGroup, Path=Key}" />
</i:EventTrigger>
</i:Interaction.Triggers>
还有这个
<igWPF:OutlookBarGroup.InputBindings>
<MouseBinding MouseAction="LeftClick"
Command="{Binding OnBarGroupChangeCommand}" CommandParameter="{Binding ElementName=ReportsBarGroup, Path=Key}"/>
</igWPF:OutlookBarGroup.InputBindings>
这两个都有效。 这两种情况的问题是按下按钮时事件会触发。 我只需要在释放按钮时触发它。 MouseBinding似乎不支持这一点。 有没有办法通过互动来做到这一点? 处理这个问题的最佳方法是什么? 谢谢。
尝试EventTrigger事件名称“ MouseLeftButtonUp ”。
我对C#不太熟悉,但据我所知,MouseBinding不允许支持鼠标操作,只允许鼠标按下。 看看这里的答案
为什么不尝试这个:
private void btn_MouseUp(object sender, MouseEventArgs e)
{
/////WHAT YOU WANT THE BUTTON TO DO/////
}
如果您需要了解有关鼠标事件的更多信息,请输入此处
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.