//This method is what iterates the selected items in the ListView against the entire master list to change the value of the Check variable private void CheckItem(List <ElementIdName> _list, List <ElementIdName> _temp, bool _check) { //Iterate through each of the selected rows in the List View foreach (ElementIdName view in _temp) { //Try and find the item in the main SheetList list and get that object //We can't directly change the SheetList because we have linked it to the Listview //and we are using NotifyPropertyChanged events so that is why we need temp items ElementIdName item = _list.Find(x => x.ElemId == view.ElemId); //set the bool Check variable to true or checked item.Check = _check; } }
private void CheckBox_Unchecked(object sender, RoutedEventArgs e) { //Cast the selected items in the ListView to a List of the ViewSheets class List<ElementIdName> TempViews = ListViewLinkedViews.SelectedItems.Cast<ElementIdName>().ToList(); //iterate through each of the ViewSheets items in that list foreach (ElementIdName View in TempViews) { //Try and find the item in the main SheetList list and get that object //We can't directly change the SheetList because we have linked it to the Listview //and we are using NotifyPropertyChanged events so that is why we need temp items ElementIdName item = LinkedSchedules.Find(x => x.ElemId == View.ElemId); //set the bool Check variable to true or checked item.Check = false; } }