[英]Visual C# How do you simulate click a button?
Is there any way to run a button's event handler from code?有没有办法从代码运行按钮的事件处理程序?
I tried我试过
btn.click(); btn.mousedown();
I tried calling the event handler but I didn't know what parameter goes to RoutedEventArgs e
我尝试调用事件处理程序,但我不知道
RoutedEventArgs e
参数是什么
you can directly call the button using btn.click();
您可以使用
btn.click();
直接调用按钮btn.click();
and btn.mousedown();
和
btn.mousedown();
and pass a new EventArgs(
) RoutedEventArgs.并传递一个
new EventArgs(
) RoutedEventArgs。
Like喜欢
btn.click(btn,new EventArgs());
You can also call你也可以打电话
btn.PerformClick();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.