WPF的MouseLeftButtonUp没有发射 [英] WPF MouseLeftButtonUp Not Firing

查看:900
本文介绍了WPF的MouseLeftButtonUp没有发射的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在WPF怪现象......当我设置的事件鼠标松开我可以让它火,当我用鼠标右键单击该按钮。但是,这将不会触发与可以单击!

Strange happenings in WPF... When I set the event to MouseUp I can get it to fire when I right-click the button. But this won't fire with either click!

               <Button MouseLeftButtonUp="btnNewConfig_MouseUp"  Name="btnNewConfig">
                    <StackPanel Orientation="Horizontal">
                        <Image Source="Icons\new.ico" Height="24" Width="24" Margin="5"/>
                        <TextBlock VerticalAlignment="Center">New</TextBlock>
                    </StackPanel>
                </Button>

我知道这是最有可能的简单的东西。感谢您的帮助!

I know this is most likely something simple. Thanks for the help!

推荐答案

看起来像Button控件是吃了该事件由于Button.Click实际上是LeftButtonDown事件和LeftButtonUp事件。

Looks like Button control is eating up that event Since Button.Click is actually a combination of LeftButtonDown event and LeftButtonUp event.

但是,你可以订阅隧道事件的 previewMouseLeftButtonUp上的按钮获得LeftButtonUp

But you can subscribe to the Tunnelled event PreviewMouseLeftButtonUp on the Button to get LeftButtonUp

这篇关于WPF的MouseLeftButtonUp没有发射的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆