title: How to assign click event
body: <p>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,</p>
  <p>what is the code equivalent for XAML:</p>
  <pre><code>&lt;Button x:Name=&quot;btn1&quot; Click=&quot;btn1_Click&quot;&gt;
  </code></pre>
  <p>Or, what should I place for &quot;????&quot; in the following Code:</p>
  <pre><code>Button btn = new Button();
  btn.Name = &quot;btn1&quot;;
  btn.???? = &quot;btn1_Click&quot;;
  </code></pre>