public void Load(LevelDataBlock subject) { if (Subject != subject) { Source = subject.Parameters.Values.ToList(); Subject = subject; } ParameterStack.Children.Clear(); foreach (var param in Source) { var dock = new Grid() { Margin = new Thickness(0, 0, 0, 5) }; dock.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Star), }); dock.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Star) }); var deleteButton = new Button() { Content = "x", Background = Brushes.DarkRed, BorderBrush = Brushes.Red, Margin = new Thickness(0, 0, 10, 0) }; deleteButton.Click += DeleteButton_Click; deleteButton.Tag = param; var stack = new DockPanel(); stack.Children.Add(deleteButton); Grid.SetColumn(stack, 0); dock.Children.Add(stack); var textbox = new TextBox() { Text = param.Value }; dock.Children.Add(textbox); Grid.SetColumn(textbox, 1); textbox.KeyDown += Textbox_KeyDown; textbox.Tag = param; var nameBox = new TextBlock() { Margin = new Thickness(0, 0, 10, 0), Text = param.Name + ":" }; DockPanel.SetDock(nameBox, Dock.Right); stack.Children.Add(nameBox); ParameterStack.Children.Add(dock); } AddNewButton.IsEnabled = true; BlockParameter.LoadParameterDB(); namebox.AutoSuggestionList.Clear(); foreach (var name in BlockParameter.ParameterDBDescriptions.Keys) { namebox.AutoSuggestionList.Add(name); } }