title: How to get all the textBoxes in the UserControl added into GridView
body: <p>On the Page, I add UserControl into GridView dynamically. So, each UserControl can contain different kind of controls ( TextBox, CheckBox, Radio Button) </p>
  
  <p>say , the name of UserControl is : UserForm.</p>
  
  <p>problem : 
  How to get a collection of control using VisualTreeHelper and check if textBox is empty.</p>
  
  <p>I found a code similiar to this problem and modified it but not working.</p>
  
  <p>I dont know what this means and if this is required?</p>
  
  <p>list.AddRange(AllTextBoxes(child))</p>
  
  <p>Should I use MyList.Select() or MyList.Where() ?</p>
  
  <pre>
  
  void FindTextBoxes()
  {
  
     List &lt;TextBox> MyList = AllTextBoxes(UserForm);
  
     var count = MyList.Where(x= &gt; if(string.IsEmptyOrNull(x.Text));
  
  }
  
  
  
  
  List &lt;TextBox> AllTextBoxes(DependencyObject parent)
  {
      var list = new List &lt;TextBox>();
  
      for (int i = 0; i &lt; VisualTreeHelper.GetChildrenCount(parent); i++)
      {
          var child = VisualTreeHelper.GetChild(parent, i);
  
          if (child is TextBox)
  
              list.Add(child as TextBox);
  
          list.AddRange(AllTextBoxes(child));
      }
      return list;
  }
  
  
  </pre>