private void OnAddAdditionalEquipmentExecute() { var newEquipment = new CarAdditionalEquipmentWrapper(new CarAdditionalEquipment()); newEquipment.PropertyChanged += CarAdditionalEquipmentWrapper_PropertyChanged; CarAdditionalEquipments.Add(newEquipment); Car.ClassModel.CarAdditionalEquipments.Add(newEquipment.ClassModel); newEquipment.AdditionalEquipment = string.Empty; // Trigger validation }
private void InitializeCarAdditionalEquipments(ICollection <CarAdditionalEquipment> carAdditionalEquipments) { foreach (var wrapper in CarAdditionalEquipments) { wrapper.PropertyChanged -= CarAdditionalEquipmentWrapper_PropertyChanged; } CarAdditionalEquipments.Clear(); foreach (var additionalEquipment in carAdditionalEquipments) { var wrapper = new CarAdditionalEquipmentWrapper(additionalEquipment); CarAdditionalEquipments.Add(wrapper); wrapper.PropertyChanged += CarAdditionalEquipmentWrapper_PropertyChanged; } }