private void ListView_MemberSportsSelection(object sender, SelectionChangedEventArgs e) { var item = (sender as ListView).SelectedItem as Sport; if (item != null) { Sports.Add(item); MemberSports.Remove(item); Clubs.Clear(); foreach (Sport memberSport in MemberSports) { foreach (Club clubMemberSport in memberSport.Clubs) { Clubs.Add(clubMemberSport); } } var memClubs = new List <Club>(); foreach (Club c in MemberClubs) { memClubs.Add(c); } foreach (Club c in memClubs) { foreach (Club club in item.Clubs) { if (club.Id == c.Id) { MemberClubs.Remove(c); } } } } }
private void ListView_MemberClubsSelection(object sender, SelectionChangedEventArgs e) { var item = (sender as ListView).SelectedItem as Club; if (item != null) { Clubs.Add(item); MemberClubs.Remove(item); } }
private void ClearFields() { Member = new Member(); MemberClubs.Clear(); MemberSports.Clear(); Clubs.Clear(); Sports.Clear(); foreach (Sport s in AllSports) { Sports.Add(s); } }