private void OnAddComponentExecute() { var newComponent = new ProjectComponentWrapper(new ProjectComponent()); newComponent.PropertyChanged += ProjectComponentWrapper_PropertyChanged; ProjectComponents.Add(newComponent); Project.Model.ProjectComponents.Add(newComponent.Model); newComponent.ComponentName = ""; // Trigger validation :-) }
private void InitializeProjectComponents(ICollection <ProjectComponent> projectComponents) { foreach (var wrapper in ProjectComponents) { wrapper.PropertyChanged -= ProjectComponentWrapper_PropertyChanged; } ProjectComponents.Clear(); foreach (var projectComponent in projectComponents) { var wrapper = new ProjectComponentWrapper(projectComponent); ProjectComponents.Add(wrapper); wrapper.PropertyChanged += ProjectComponentWrapper_PropertyChanged; } }