创建button的时候给button命名,然后在button的Click的事件中获取Name即可
var button = new Button { Name = "Button" };
button.Click+=new RoutedEventHandler(Button_Click);
private void Button_Click(object sender, RoutedEventArgs e)
{
var button = sender as Button;
var buttonName = button.Name;
MessageBox.Show(buttonName);
}