WPF 命令 - 处理程序的调用
我是 WPF 的初学者。我读到了有关命令的信息,何时触发命令的处理程序,因为我为按钮和菜单附加了一个 Coomand,处理程序被调用,或者菜单或单击按钮。双击按钮是否可以调用处理程序。
I am a beginner to WPF. I read about commands , when do the handlers for the command get triggered, because i attached a Coomand for the button and a menu , the handler is invoked either the menu or the button is clicked. Is it possible to invoke the handler on double clicking the button.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果我正确理解了查询,那么您将尝试将相同的命令附加到按钮和菜单。那么我应该说该命令将在这两种情况下执行。
检查以下链接。
http://joshsmithonwpf.wordpress.com/2008/03/18/ Understanding-routed-commands/
http://www.codeproject.com/KB /WPF/WPFCommandingTheBasic.aspx
http://www.codeproject.com/KB /WPF/WpfCommandPatternApplied.aspx
在双击的情况下,请检查下面的链接
http://www.thejoyofcode.com/Invoking_a_Command_on_a_Double_Click_or_other_Mouse_Gesture.aspx
另请参阅 Marlon Grech 的 附加命令行为。它将为您提供一些附加功能,
这肯定会让您入门。希望它有所帮助
If i understood the query properly then you are trying to attach the same command to both a button and a menu.Then i should say the command will get executed for both the cases.
Check the following links.
http://joshsmithonwpf.wordpress.com/2008/03/18/understanding-routed-commands/
http://www.codeproject.com/KB/WPF/WPFCommandingTheBasic.aspx
http://www.codeproject.com/KB/WPF/WpfCommandPatternApplied.aspx
In the case of double click Check the link below
http://www.thejoyofcode.com/Invoking_a_Command_on_a_Double_Click_or_other_Mouse_Gesture.aspx
Also go through Marlon Grech's attached command behaviors .It will give you a handfull of added functionalities
This will get you started for sure.Hope it helps