private void AllSelection_Click(object sender, RoutedEventArgs e) { CheckBox checkBox = sender as CheckBox; if (!(bool)checkBox.IsChecked) // The user unchecked { CheckBoxList.ForEach(a => a.IsChecked = false); } else // The user checked { CheckBoxList.ForEach(a => a.IsChecked = true); } }
private void InitRowSelection() { RowSelection = new UC_RowSelection(); RowSelection.AllSelection.Click += AllSelection_Click; menuItems.Add(new Separator()); CreateCheckBox(); Manager.RowCollectionView.CollectionChanged += RowCollectionView_CollectionChanged; CheckBoxList.ForEach(a => RowSelection.MainStackPanel.Children.Add(a)); Manager.CollectionViewSource.Filter += new FilterEventHandler(RowSelection_Filter); //menuItems.Add(grid); menuItems.Add(RowSelection); }