title: WPF foreach textbox loop
body: <p>I'm trying to understand why this code doesn't work.</p>
  
  <p>Can someone help?</p>
  
  <pre><code>        foreach (TextBox replyBox in textboxPanel.Children.OfType&lt;TextBox&gt;())
          {
              if (replyBox.Name.Contains("Reply"))
              {
                  textboxPanel.Children.Remove(replyBox);
              }
          }
  </code></pre>
  
  <p>It return a message saying the type has changed.</p>
  
  <p>I've seen some other post using <code>panel.controls</code> but I don't have that for my panel somehow.</p>
  
  <p>regards,</p>