title: How to get the row and column of button clicked, in the grid event handler?
body: <p>Once the added button in grid(window control Grid, not Gridview or datagrid) is clicked, how to find which row and column the button is located in the grid event handler, like click event or some other events? Not the button click event handler</p>
  
  <pre><code>        #region Grid event handler setup
          myGrid.MouseEnter += new MouseEventHandler(myGrid_MouseEnter);
          myGrid.MouseLeave += new MouseEventHandler(myGrid_MouseLeave);
          myGrid.MouseDown += new MouseButtonEventHandler(myGrid_MouseDown);
          myGrid.MouseUp += new MouseButtonEventHandler(myGrid_MouseUp);
          #endregion
  </code></pre>
  
  <p>Thanks</p>
  
  <p>I notice that Boyan has some solution for the button click event handler case</p>
  
  <p><a href="https://stackoverflow.com/questions/363100/in-wpf-how-can-i-determine-what-column-row-in-a-grid-a-control-is">In WPF, how can I determine what column/row in a grid a control is in?</a></p>
  
  <p>In the Click event handler for the button you say:</p>
  
  <pre><code>int row; 
  Button btn = sender as Button; 
  if (btn != null) 
  { 
      row = Grid.GetRow(btn); // And you have the row number... 
  } 
  else 
  { 
      // A nasty error occurred... 
  }
  </code></pre>