/// <summary> /// Removes matches with null value (don't know why they are there) and /// sorts by LastActivityDate in descending order /// </summary> private void MatchListSetup() { // Adds event handlers for each message list foreach (var item in MatchList) { item.Messages = item.Messages ?? new ObservableCollection <MessageModel>(); // For when there are already handlers attached item.Messages.CollectionChanged -= Messages_CollectionChanged; item.Messages.CollectionChanged += Messages_CollectionChanged; } // Remove ghost matches, which I don't know why exist for (int i = 0; i < MatchList.Count; i++) { if (MatchList[i].Person == null) { MatchList.RemoveAt(i--); } } FilterVM.SortMatchList(); }
public void RemoveLast() { matchlist.RemoveAt(matchlist.Count - 1); }