private void chkAll_Loaded(object sender, RoutedEventArgs e) { chkAll = sender as CheckBox; if (this.ExamPlaceItemsSource != null) { chkAll.IsChecked = ExamPlaceItemsSource.Any(item => item.IsChecked); } }
private void Button_Click(object sender, RoutedEventArgs e) { int checkcount = ExamPlaceItemsSource.Count(r => r.IsChecked == true); if (checkcount == 0) { MessageBox.Show("请选择考点", "消息提示", MessageBoxButton.OK); return; } ExamPlace[] selectExamPlaces = ExamPlaceItemsSource.Where(o => o.IsChecked == true).ToArray(); if (OnGetDataEvent != null) { OnGetDataEvent(selectExamPlaces); } this.Close(); }
private void chkCell_Click(object sender, RoutedEventArgs e) { if (ExamPlaceItemsSource != null) { int checkcount = ExamPlaceItemsSource.Count(r => r.IsChecked == true); if (checkcount == ExamPlaceItemsSource.Length) { chkAll.IsChecked = true; } else if (checkcount == 0) { chkAll.IsChecked = false; } else { chkAll.IsChecked = null; } } }