silverlight中CheckBox在DataGrid的全选/取消 -转载
时间:2010-11-19 来源:hl3292
DataGrid控件没有rows等属性我们如何全选与取消呢,在运用过程中做了个人小结,如果还有好方法,多多学习:
if (this.CBAll.IsChecked.Value)//全选 { foreach (object ovj in ContentGrid.ItemsSource) { CheckBox cb1 = ContentGrid.Columns[0].GetCellContent(ovj).FindName("ck") as CheckBox; //cb为 cb1.IsChecked = true; } } else//取消 { foreach (object obj in ContentGrid.ItemsSource) { CheckBox cb2 = ContentGrid.Columns[0].GetCellContent(obj).FindName("ck") as CheckBox; cb2.IsChecked = false; } }
相关阅读 更多 +