wpf 遍历控件及其值

private void SetNotEditable(UIElementCollection uiControls)

 {          
     foreach (UIElement element in uiControls)
     {
         if (element is TextBox)
         {
             TextBox txtBox = (element as TextBox);                 
         }
         else if (element is Grid)
         {
             this.SetNotEditable((element as Grid).Children);
         }
     }
}
原文地址:https://www.cnblogs.com/fan-yuan/p/10192752.html