title: Using a while loop to go through WPF elements
body: <p>In JavaScript I can loop through a series of elements fairly easily, like so:</p>
  
  <pre><code>var x = 0;
  while (document.getElementById("MyElement-" + x)) {
      // Do something    
  
      x++;
  }
  </code></pre>
  
  <p>What would be the equivalent of doing this in C# with WPF elements?</p>
  
  <pre><code>&lt;Grid x:Name="MyElement_0" /&gt;
  &lt;Grid x:Name="MyElement_1" /&gt;
  &lt;Grid x:Name="MyElement_2" /&gt;
  &lt;!-- Etc... --&gt;
  </code></pre>
  
  <p>Thanks!</p>