title: Count the number of visible rows in a DataGrid
body: <p>I would like to know how many rows are actually displayed by a WPF <code>DataGrid</code>.</p>
  
  <p>I tried looping over <code>DataGridRow</code> and checking <code>IsVisible</code>, but it seems that rows report <code>IsVisible = true</code> even when they are not in the <code>DataGrid</code> viewport.</p>
  
  <p>How can I count the number of visible rows correctly?</p>