在silverlight中发送鼠标点击按钮2 [英] Sending a mouse click to a button in silverlight 2
本文介绍了在silverlight中发送鼠标点击按钮2的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在silverlight应用程序中有按钮控件。我可以通过编程方式发送一个鼠标点击事件吗?
There is the button control in silverlight application . Can I send a mouse click event to it programmatically?
推荐答案
如果你还想这样做您现在可以升级到Silverlight版本3.0或更高版本,并执行以下操作:
If you still want to do that. You can now upgrade to Silverlight version 3.0 or later versions and do the following:
您可以使用System.Windows.Automation.Peers中的按钮自动化对等方来完成您如果(按钮是按钮)
{
ButtonAutomationPeer对等体=新的ButtonAutomationPeer((按钮))
You can use the button automation peer from System.Windows.Automation.Peers to accomplish what you want.
if (button is Button)
{
ButtonAutomationPeer peer = new ButtonAutomationPeer((Button)button);
IInvokeProvider ip = (IInvokeProvider)peer;
ip.Invoke();
}
这篇关于在silverlight中发送鼠标点击按钮2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文