diff --git a/COMETwebapp/ViewModels/Components/ModelEditor/ElementDefinitionTableViewModel.cs b/COMETwebapp/ViewModels/Components/ModelEditor/ElementDefinitionTableViewModel.cs index bb0dfa2b..06e9ab43 100644 --- a/COMETwebapp/ViewModels/Components/ModelEditor/ElementDefinitionTableViewModel.cs +++ b/COMETwebapp/ViewModels/Components/ModelEditor/ElementDefinitionTableViewModel.cs @@ -322,14 +322,18 @@ protected override async Task OnThingChanged() this.RowsTarget.Clear(); this.RowsSource.Clear(); - this.CurrentThing.Element.ForEach(e => + foreach (var element in this.CurrentThing.Element) { - this.Elements.Add(e); - this.Elements.AddRange(e.ContainedElement); - }); + this.Elements.Add(element); + this.Elements.AddRange(element.ContainedElement); + } + + foreach (var element in this.Elements) + { + this.RowsTarget.Add(new ElementDefinitionRowViewModel(element)); + this.RowsSource.Add(new ElementDefinitionRowViewModel(element)); + } - this.Elements.ForEach(e => this.RowsTarget.Add(new ElementDefinitionRowViewModel(e))); - this.Elements.ForEach(e => this.RowsSource.Add(new ElementDefinitionRowViewModel(e))); this.AddParameterViewModel.InitializeViewModel(this.CurrentThing); this.ElementDefinitionCreationViewModel.InitializeViewModel(this.CurrentThing);