I have several buttons with contents 1, 2, 3, 4, 5 ... like this. All buttons use the same function in the Click event.
<Button Content="1" Height="30" Name="button1" Width="30" Click="calculate"/> <Button Content="2" Height="30" Name="button2" Width="30" Click="calculate"/> <Button Content="3" Height="30" Name="button3" Width="30" Click="calculate"/> <Button Content="4" Height="30" Name="button4" Width="30" Click="calculate"/> <Button Content="5" Height="30" Name="button5" Width="30" Click="calculate"/>
How can I find out which button is pressed in the count function? I want to get the content with the button pressed.
private void calculate(object sender, RoutedEventArgs e) { }
Thanks.
source share