0

I have a button in Windows Phone 8.1.

Button x:FieldModifier="public" x:Name="button1" Content="1" HorizontalAlignment="Left" Margin="10,141,0,0" VerticalAlignment="Top" Click="button1_Click" PointerMoved="button1_PointerMoved" KeyDown="button1_KeyDown"/

How to fire all event of the button automatically? (Click, PointerMoved, KeyDown)

Trang Le
  • 71
  • 1
  • 7

1 Answers1

1

You can get the list of the delegates from event

var handler = myButton.Click;
var allDelegates= e.GetInvocationList();

And call each one in the for loop

foreach (var delegate in allDelegates) 
{
   delegate();
}
Max Brodin
  • 3,903
  • 1
  • 14
  • 23