private TextBox AddTextBox(string id, string name, string content, string parentId, string parentOptionId, DockPanel dockPanel) { //var wb = new WebService(); TextBox standardName = new TextBox { Name = name, Text = content, MinWidth = 200, Margin = new Thickness(50, 0, 50, 0) }; TextBoxIdentity textBoxIdentity = new TextBoxIdentity { Id = id, TextBox = standardName, TextBoxChildren = new List<UIElement>(), ParentOptionId = parentOptionId, ParentPanelId = dockPanel.Uid }; DockPanelIdentity panel = new DockPanelIdentity { Id = dockPanel.Uid, Name = "Dp" + name, Panel = dockPanel }; if (parentId != null) { standardName.Visibility = Visibility.Collapsed; dockPanel.Visibility = Visibility.Collapsed; foreach (var boxIdentity in ComboBoxIdentityList) { if (boxIdentity.Id == parentId) { boxIdentity.ComboBoxChildren.Add(standardName); } } } DockPanelIdentityList.Add(panel); TextBoxIdentityList.Add(textBoxIdentity); //objservice.AddTextBox(id, name, content, child, parentId); //wb.AddTextBox(id, name, content, child, parentId); return standardName; }
private ComboBox AddComboBox(string id, ObservableCollection<ComboBoxOption> bindingList, string name, string parentId, string parentOptionId, Panel dockPanel) { //var wb = new WebService(); //wb.AddComboBox(id, bindingList, child, name, parentId); ComboBox comboBox = new ComboBox { Name = name, ItemsSource = bindingList, DisplayMemberPath = "DisplayName", SelectedValuePath = "Value", SelectedIndex = 0, MinWidth = 200, Margin = new Thickness(50, 0, 50, 0) }; ComboBoxIdentity combo = new ComboBoxIdentity { Id = id, ComboBox = comboBox, ComboBoxChildren = new List<UIElement>(), ParentId = parentId, ParentOptionId = parentOptionId, ParentPanelId = dockPanel.Uid }; DockPanelIdentity panel = new DockPanelIdentity { Id = dockPanel.Uid, Name = "Dp" + name, Panel = dockPanel }; if (parentId != null) { comboBox.Visibility = Visibility.Collapsed; ComboBoxIdentity comboBoxIdentity = ComboBoxIdentityList.First(x => x.Id == parentId); comboBoxIdentity.ComboBoxChildren.Add(comboBox); dockPanel.Visibility = Visibility.Collapsed; } comboBox.SelectionChanged += combo_SelectionChanged; ComboBoxIdentityList.Add(combo); DockPanelIdentityList.Add(panel); ComboboxList.Add(comboBox); return comboBox; }