我在Windows Phone 8.1中有一个按钮。
按钮x:FieldModifier =" public" X:名称="按钮1"含量=#&34; 1"的HorizontalAlignment ="左"余量=" 10,141,0,0" VerticalAlignment ="顶"点击="的button1_Click" PointerMoved =" button1_PointerMoved"的KeyDown =" button1_KeyDown&#34 /
如何自动触发按钮的所有事件? (单击,PointerMoved,KeyDown)
答案 0 :(得分:1)
您可以从event
var handler = myButton.Click;
var allDelegates= e.GetInvocationList();
并在for循环中调用每个
foreach (var delegate in allDelegates)
{
delegate();
}