This is the sceneria where multiple buttons having same click event,and so we need to find which button is clicked on code behind when "Click" is fired.For example here i taken 3 buttons b1,b2,b3 with same click event is "GetName_Click".
Xaml:
<Button Name="b1" Click="GetName_Click"/>
<Button Name="b2" Click="GetName_Click"/>
<Button Name="b3" Click="GetName_Click"/>
C#:
private void GetName_Click(object sender, RoutedEventArgs e)
{
Button btn = sender as Button;
if(btn.Name=="b1")
{
//selected button name is 'b1'
}
if (btn.Name == "b2")
{
//selected button name is 'b2'
}
if (btn.Name == "b3")
{
//selected button name is 'b3'
}
}