There was a situation that developers want to add controls to canvas according to some arguments. So some codes as below.

Button checkBtn = new Button();

checkBtn.Click += new RoutedEventHandler(checkBtn_Click);

Canvas.SetLeft(checkBtn, 405);

Canvas.SetTop(checkBtn, interval * (i - 1));


By the way, you can do something based on event caller

private void checkBtn_Click(object sender, RoutedEventArgs e)


Button b = e.OriginalSource as Button;


Oh, some implementation in practice like this app(Go_Dutch) I made.