title: Border Element How to add Click Event Programmaticaly
body: <p>I have  a code snippet like below. I am generating new border elements and adding it to parent Grid element. I want to handle click event when border element clicked. br.addHandler command is not working.          </p>
  
  <pre><code>for (var h = 0; h &lt; heightInt; h++)
          {
              for (var w = 0; w &lt; widthInt; w++)
              {
                  Border br = new Border()
                  {
                      BorderThickness = new Thickness(1),
                      BorderBrush = Brushes.Black
                  };
  
                  br.SetValue(Grid.ColumnProperty, w);
                  br.SetValue(Grid.RowProperty, h);
                  br.AddHandler(Button.ClickEvent, new RoutedEventHandler(borders_Click),true);
  
                  EditorGr.Children.Add(br);
              }
          }
          private void borders_Click(object sender, RoutedEventArgs e)
          {
              MessageBox.Show("asdf");
          }
  </code></pre>