例:Grid的子项是包含边框的复选框CheckBox
1 //遍历Grid中的子项 2 foreach (var c in this.grid_box.Children) 3 { 4 Border bd = c as Border;//列边框 5 if (bd.Child.GetType().Name.Equals("CheckBox")) 6 { 7 CheckBox cb_box = bd.Child as CheckBox; 8 cb_box.IsChecked = false;//取消选中复选框 9 } 10 }
知识一点点的累积,技术一点点的提高!加油!