将鼠标单击发送到 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 中的按钮自动化对等点来完成您想要的操作.
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屋!
查看全文