Say I added a series buttons to a WPF app progammatically, as part of a label, textbox, button section, and attached a single handler to the click event of all of these. How can I specify which button (pertaining to which section) is being clicked, so it can be handled accordingly?
Attaching individuals handlers won't work since the user must be able to add as many of these 'lines' as needed.
A possible alternative would be to pass information to the event handler, such as:
...
var sender = this;
var args = new CustomEventArgs(sectionName);
var button = new Button();
button.Click += Button_EventHandler_Click(sender, args);
But I haven't found a way to this in C#.
Any help/idea will be appreciated!
Thanks