title: WPF C# button click event in code behind
body: <p>I have create a button in code behind , but how do i write their click event? is it MouseDown? like this ? Basically i want to detect if the button is being pressed then i populate a textbox with some text.</p>
  
  <pre><code>Button btn1 = new Button();
  btn1.Content = qhm.Option1;
  sp1.Children.Add(btn1);
  
  if (btn1.MouseDown = true)
  {
     tbox.Text = qhm.Option1;
  }
  </code></pre>