WPF button click in C# code

Posted by KMC on Stack Overflow See other posts from Stack Overflow or by KMC
Published on 2011-02-24T09:34:18Z Indexed on 2011/02/24 15:24 UTC
Read the original article Hit count: 198

Filed under:
|
|
|

I have an array of button which is dynamically generated at run time. I have the function for button click in my code, but I can't find a way to set the button's click name in code. So,

what is the code equivalent for XAML:

<Button x:Name="btn1" Click="btn1_Click">

Or, what should I place for "????" in the following Code:

Button btn = new Button()
btn.Name = "btn1";
btn.???? = "btn1_Click";

© Stack Overflow or respective owner

Related posts about c#

Related posts about wpf