title: What Event Happens After Loaded For A WPF UserControl?
body: <p>I have a DataGrid, which I bind in the constructor function of my UserControl (after InitializeComponent).  I need to access some rows in it, so in the loaded event for the UserControl, I run:</p>
  
  <pre><code>DataGridRow row = (DataGridRow)myDataGrid.ItemContainerGenerator.ContainerFromIndex(rowIdx);
  </code></pre>
  
  <p>However whenever I do that, ItemContainerGenerator.ContainerFromIndex returns null.  Seemed like the DataGrid wasn't fully generated yet, so to test/confirm that theory, I threw a button on the screen, and on the click event of the button, I ran that code again, and then sure enough, the row had a value.  So, it's confirmed, when the UserControl's loaded event fires, it happens too early and I can't yet call ItemContainerGenerator.ContainerFromIndex for my DataGrid.</p>
  
  <p>What event gets fired after loaded that I could use instead?</p>
  
  <p><strong>Note</strong>: I also tried this code that I found, but got the same results:</p>
  
  <pre><code>DataGridRow row = (DataGridRow)myDataGrid.ItemContainerGenerator.ContainerFromIndex(rowIdx);
  if (row == null)
  {
      myDataGrid.UpdateLayout();
      myDataGrid.ScrollIntoView(myDataGrid.Items[rowIdx]);
      row = (DataGridRow)myDataGrid.ItemContainerGenerator.ContainerFromIndex(rowIdx);
  }
  </code></pre>
  
  <p>And I also tried doing it in the DataGrid's loaded event but same results.</p>
  
  <p>Thanks!</p>