private void UpdateOtherComboBox() { var tempCollection = new ObservableCollection <AccountViewModel>(ChargedAccounts); foreach (var account in TargetAccounts) { if (!tempCollection.Contains(account)) { tempCollection.Add(account); } } foreach (var account in tempCollection) { //fills targetaccounts if (!TargetAccounts.Contains(account)) { TargetAccounts.Add(account); } //fills chargedaccounts if (!ChargedAccounts.Contains(account)) { ChargedAccounts.Add(account); } } ChargedAccounts.Remove(selectedPayment.TargetAccount); TargetAccounts.Remove(selectedPayment.ChargedAccount); }
private void UpdateOtherComboBox() { ObservableCollection <Account> tempCollection = new ObservableCollection <Account>(ChargedAccounts); foreach (Account i in TargetAccounts) { if (!tempCollection.Contains(i)) { tempCollection.Add(i); } } foreach (Account i in tempCollection) { if (!TargetAccounts.Contains(i))//fills targetaccounts { TargetAccounts.Add(i); } if (!ChargedAccounts.Contains(i))//fills chargedaccounts { ChargedAccounts.Add(i); } } ChargedAccounts.Remove(selectedPayment.TargetAccount); TargetAccounts.Remove(selectedPayment.ChargedAccount); }