public AddCustomerViewModel(IMessenger messenger, UserLogin userLogin) : base(messenger, userLogin) { this.Entity.CustomerAddresseCollection = new Collection <CustomerAddress> { new CustomerAddress() { } }; this.Entity.CustomerPhoneCollection = new Collection <CustomerPhone> { new CustomerPhone() }; if (this.Entity != null) { this.Entity.CustomerAddresseCollection.ForEach(x => { x.PropertyChanged += (sender, args) => { if (args.PropertyName == "City") { var item = sender as CustomerAddress; if (item != null) { item.IsOtherCity = (item.City == "Other"); if (!_weakRefLocationCollection.IsAlive) { GetLocationCollection(); } if (_weakRefLocationCollection.IsAlive) { var collection = _weakRefLocationCollection.Target as Dictionary <string, string>; if (collection != null) { item.State = collection.FirstOrDefault(y => y.Key == item.City).Value; } item.Country = CountryCollection.FirstOrDefault(); } } } }; }); } }