wpf 遍历控件及其值

       /// <summary>
        /// 遍历控件及其值
        /// </summary>
        /// <param name="uiControls">界面控件</param>
       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);
                }
            }
       }

 

posted @ 2015-11-09 16:50  天翊无影  阅读(3937)  评论(0编辑  收藏  举报