public ParameterMap(Graph g, Dictionary <string, GraphParameterValue> values) { InitializeComponent(); foreach (var k in values.Keys) { string[] split = k.Split('.'); var v = values[k]; if (!v.IsFunction()) { Node n = null; g.NodeLookup.TryGetValue(split[0], out n); PropertyLabel lbl = new PropertyLabel(); lbl.Title = v.Name; Stack.Children.Add(lbl); if (n != null) { BuildParameter(split[1], v, n); } } } }
public ParameterMap(List <GraphParameterValue> values, bool useBasic = false) { InitializeComponent(); foreach (var v in values) { if (!v.IsFunction()) { if (v.Type != NodeType.Bool) { PropertyLabel lbl = new PropertyLabel(); lbl.Title = v.Name; Stack.Children.Add(lbl); } if (!useBasic) { BuildParameterCustom(v); } else { BuildParameter(v); } } } }
public GraphParameterEditor(Graph g, Dictionary <string, GraphParameterValue> values) { InitializeComponent(); foreach (var k in values.Keys) { string[] split = k.Split('.'); var v = values[k]; if (!v.IsFunction()) { Node n = null; g.NodeLookup.TryGetValue(split[0], out n); PropertyLabel lbl = new PropertyLabel(); if (n == null) { lbl.Title = split[1] + " - Parameter Name"; } else { lbl.Title = n.Name + " - " + split[1] + " - Parameter Name"; } Stack.Children.Add(lbl); var info = v.GetType().GetProperty("Name"); PropertyInput inp = new PropertyInput(info, v); Stack.Children.Add(inp); } } }
public CustomFunction(FunctionGraph g) { InitializeComponent(); graph = g; var prop = graph.GetType().GetProperty("Name"); PropertyLabel lbl = new PropertyLabel("Function Name"); Stack.Children.Add(lbl); PropertyInput pinput = new PropertyInput(prop, graph); Stack.Children.Add(pinput); }
private void Cp_OnRemove(GraphParameter c) { PropertyLabel lb = null; if (labelLookup.TryGetValue(c.Id, out lb)) { Stack.Children.Remove(lb); labelLookup.Remove(c.Id); } Stack.Children.Remove(c); string[] split = c.Id.Split('.'); graph.RemoveParameterValue(split[0], split[1]); }
public GraphParameterEditor(Graph g, Dictionary <string, GraphParameterValue> values) { InitializeComponent(); graph = g; labelLookup = new Dictionary <string, PropertyLabel>(); foreach (var k in values.Keys) { string[] split = k.Split('.'); var v = values[k]; if (!v.IsFunction()) { Node n = null; g.NodeLookup.TryGetValue(split[0], out n); PropertyLabel lbl = new PropertyLabel(); if (n == null) { n = g.FindSubNodeById(split[0]); } if (n == null) { lbl.Title = split[1]; } else { lbl.Title = n.Name + " - " + split[1]; } Stack.Children.Add(lbl); GraphParameter cp = new GraphParameter(v, k); cp.OnRemove += Cp_OnRemove; labelLookup[k] = lbl; Stack.Children.Add(cp); } } }
public ParameterMap(Dictionary <string, GraphParameterValue> values) { InitializeComponent(); foreach (var k in values.Keys) { string[] split = k.Split('.'); var v = values[k]; if (!v.IsFunction()) { if (v.Type != NodeType.Bool) { PropertyLabel lbl = new PropertyLabel(); lbl.Title = v.Name; Stack.Children.Add(lbl); } BuildParameter(v); } } }
public void Set(Graph g, Dictionary <string, GraphParameterValue> values, bool showLabel = true, bool inlinePropertyLabels = false) { Clear(); Dictionary <string, List <Tuple <PropertyLabel, UIElement> > > sorter = new Dictionary <string, List <Tuple <PropertyLabel, UIElement> > >(); foreach (var k in values.Keys) { var v = values[k]; if (v.IsFunction()) { continue; } string[] split = k.Split('.'); var n = g.FindSubNodeById(split[0]); PropertyInfo nodeInfo = null; string customHeader = ""; if (n != null) { nodeInfo = n.GetType().GetProperty(split[1]); if (nodeInfo == null && n is GraphInstanceNode) { //then it might be an underling custom parameter on the node GraphInstanceNode inst = n as GraphInstanceNode; var realParam = inst.GetCustomParameter(split[1]); if (realParam != null) { //initiate custom header //for proper underlying processing //on the label customHeader = "$Custom."; //just set the parameter inputtype the same //also ensure min and max are the same v.InputType = realParam.InputType; v.Max = realParam.Max; v.Min = realParam.Min; v.Section = realParam.Section; } } } PropertyLabel lbl = new PropertyLabel(v.Name, n, customHeader + split[1]); EditableAttribute ed = null; if (nodeInfo != null) { ed = nodeInfo.GetCustomAttribute <EditableAttribute>(); } if (ed == null) { ed = new EditableAttribute(GetParamInputType(v), v.Name, v.Section, v.Min, v.Max); } UIElement ele = BuildParamater(v, ed, v.GetType().GetProperty("Value"), nodeInfo); if (ele != null) { string inherit = ""; if (g != null && g.ParentNode is GraphInstanceNode) { inherit = "Inherited "; } string sect = inherit + v.Section; if (string.IsNullOrEmpty(v.Section)) { sect = inherit + "Default"; } List <Tuple <PropertyLabel, UIElement> > items = null; if (sorter.TryGetValue(sect, out items)) { items.Add(new Tuple <PropertyLabel, UIElement>(lbl, ele)); } else { items = new List <Tuple <PropertyLabel, UIElement> >(); items.Add(new Tuple <PropertyLabel, UIElement>(lbl, ele)); sorter[sect] = items; } } } List <string> keys = sorter.Keys.ToList(); keys.Sort(); foreach (string k in keys) { List <Tuple <PropertyLabel, UIElement> > items = sorter[k]; if (showLabel) { PropertySection sect = new PropertySection(); sect.Title = k; if (!Stack.Children.Contains(sect) && sect.Parent == null) { Stack.Children.Add(sect); } foreach (var t in items) { if (!inlinePropertyLabels) { sect.Add(t.Item1); sect.Add(t.Item2); } else { StackPanelAuto inlinePanel = new StackPanelAuto(); inlinePanel.Direction = Orientation.Horizontal; inlinePanel.HalfAndHalf = true; inlinePanel.Children.Add(t.Item1); inlinePanel.Children.Add(t.Item2); sect.Add(inlinePanel); } } } else { foreach (var t in items) { if (!inlinePropertyLabels) { Stack.Children.Add(t.Item1); Stack.Children.Add(t.Item2); } else { StackPanelAuto inlinePanel = new StackPanelAuto(); inlinePanel.Direction = Orientation.Horizontal; inlinePanel.HalfAndHalf = true; inlinePanel.Children.Add(t.Item1); inlinePanel.Children.Add(t.Item2); Stack.Children.Add(inlinePanel); } } } } }
public void Set(Node n, List <GraphParameterValue> values, bool showLabel = true, bool inlinePropertyLabels = false) { Clear(); Dictionary <string, List <GraphParameterValue> > sorter = new Dictionary <string, List <GraphParameterValue> >(); //create a copy foreach (var p in values) { if (p.IsFunction()) { continue; } string sec = p.Section; if (string.IsNullOrEmpty(sec)) { sec = "Default"; } List <GraphParameterValue> items = null; if (sorter.TryGetValue(sec, out items)) { items.Add(p); } else { items = new List <GraphParameterValue>(); items.Add(p); sorter[sec] = items; } } List <string> keys = sorter.Keys.ToList(); keys.Sort(); foreach (string k in keys) { List <GraphParameterValue> items = sorter[k]; if (showLabel) { PropertySection sect = new PropertySection(); sect.Title = k; if (!Stack.Children.Contains(sect) && sect.Parent == null) { Stack.Children.Add(sect); } foreach (var v in items) { EditableAttribute ed = new EditableAttribute(GetParamInputType(v), v.Name, v.Section, v.Min, v.Max); UIElement ele = BuildParamater(v, ed, v.GetType().GetProperty("Value")); if (ele != null) { PropertyLabel lbl = new PropertyLabel(v.Name, n, "$Custom." + v.Name); if (!inlinePropertyLabels) { sect.Add(lbl); sect.Add(ele); } else { StackPanelAuto inlinePanel = new StackPanelAuto(); inlinePanel.Direction = Orientation.Horizontal; inlinePanel.HalfAndHalf = true; inlinePanel.Children.Add(lbl); inlinePanel.Children.Add(ele); sect.Add(inlinePanel); } } } } else { foreach (var v in items) { EditableAttribute ed = new EditableAttribute(GetParamInputType(v), v.Name, v.Section, v.Min, v.Max); UIElement ele = BuildParamater(v, ed, v.GetType().GetProperty("Value")); if (ele != null) { PropertyLabel lbl = new PropertyLabel(v.Name, n, "$Custom." + v.Name); if (!inlinePropertyLabels) { Stack.Children.Add(lbl); Stack.Children.Add(ele); } else { StackPanelAuto inlinePanel = new StackPanelAuto(); inlinePanel.Direction = Orientation.Horizontal; inlinePanel.HalfAndHalf = true; inlinePanel.Children.Add(lbl); inlinePanel.Children.Add(ele); Stack.Children.Add(inlinePanel); } } } } } }
public void Set(object n, string[] ignore = null, bool showLabel = true, bool inlinePropertyLabels = false) { Clear(); PropertyInfo[] infos = n.GetType().GetProperties(); Dictionary <string, List <Tuple <PropertyInfo, EditableAttribute> > > sorter = new Dictionary <string, List <Tuple <PropertyInfo, EditableAttribute> > >(); for (int i = 0; i < infos.Length; i++) { EditableAttribute ed = infos[i].GetCustomAttribute <EditableAttribute>(); if (ed != null) { if (ignore != null && Array.IndexOf(ignore, infos[i].Name) > -1) { continue; } List <Tuple <PropertyInfo, EditableAttribute> > items = null; string sect = ed.Section; if (string.IsNullOrEmpty(sect)) { sect = "Default"; } if (sorter.TryGetValue(sect, out items)) { items.Add(new Tuple <PropertyInfo, EditableAttribute>(infos[i], ed)); } else { items = new List <Tuple <PropertyInfo, EditableAttribute> >(); items.Add(new Tuple <PropertyInfo, EditableAttribute>(infos[i], ed)); sorter[sect] = items; } } } List <string> keys = sorter.Keys.ToList(); keys.Sort(); foreach (string k in keys) { List <Tuple <PropertyInfo, EditableAttribute> > items = sorter[k]; if (showLabel) { PropertySection sect = new PropertySection(); sect.Title = k; if (!Stack.Children.Contains(sect) && sect.Parent == null) { Stack.Children.Add(sect); } foreach (var t in items) { string name = t.Item2.Name; if (string.IsNullOrEmpty(name)) { name = t.Item1.Name; } UIElement ele = BuildParamater(n, t.Item2, t.Item1); if (ele != null) { StackPanelAuto inlinePanel = new StackPanelAuto(); inlinePanel.Direction = Orientation.Horizontal; inlinePanel.HalfAndHalf = true; //special case to eliminate the labels for //Parameter, CustomParameters, and CustomFunctions if (!(n is GraphInstanceNode && t.Item1.Name.Equals("Parameters")) && !(n is GraphInstanceNode && t.Item1.Name.Equals("CustomParameters")) && !(n is Graph && t.Item1.Name.Equals("CustomParameters")) && !(n is Graph && t.Item1.Name.Equals("Parameters")) && !(n is Graph && t.Item1.Name.Equals("CustomFunctions")) && !(n is Graph && t.Item1.Name.Equals("ParameterFunctions"))) { if (n is Node && t.Item1.GetCustomAttribute <PromoteAttribute>() != null) { PropertyLabel pl = new PropertyLabel(name, n as Node, t.Item1.Name); if (!inlinePropertyLabels) { sect.Add(pl); } else { inlinePanel.Children.Add(pl); } } else { PropertyLabel pl = new PropertyLabel(name, null, t.Item1.Name); if (!inlinePropertyLabels) { sect.Add(pl); } else { inlinePanel.Children.Add(pl); } } } if (!inlinePropertyLabels) { sect.Add(ele); } else { inlinePanel.Children.Add(ele); sect.Add(inlinePanel); } } } } else { foreach (var t in items) { string name = t.Item2.Name; if (string.IsNullOrEmpty(name)) { name = t.Item1.Name; } UIElement ele = BuildParamater(n, t.Item2, t.Item1); if (ele != null) { StackPanelAuto inlinePanel = new StackPanelAuto(); inlinePanel.Direction = Orientation.Horizontal; inlinePanel.HalfAndHalf = true; //special case to eliminate the labels for //Parameter, CustomParameters, and CustomFunctions if (!(n is GraphInstanceNode && t.Item1.Name.Equals("Parameters")) && !(n is GraphInstanceNode && t.Item1.Name.Equals("CustomParameters")) && !(n is Graph && t.Item1.Name.Equals("CustomParameters")) && !(n is Graph && t.Item1.Name.Equals("Parameters")) && !(n is Graph && t.Item1.Name.Equals("CustomFunctions")) && !(n is Graph && t.Item1.Name.Equals("ParameterFunctions"))) { if (n is Node) { PropertyLabel pl = new PropertyLabel(name, n as Node, t.Item1.Name); if (!inlinePropertyLabels) { Stack.Children.Add(pl); } else { inlinePanel.Children.Add(pl); } } else { PropertyLabel pl = new PropertyLabel(name, null, t.Item1.Name); if (!inlinePropertyLabels) { Stack.Children.Add(pl); } else { inlinePanel.Children.Add(pl); } } } if (!inlinePropertyLabels) { Stack.Children.Add(ele); } else { inlinePanel.Children.Add(ele); Stack.Children.Add(inlinePanel); } } } } } }
public void Set(Node n, List <GraphParameterValue> values, bool showLabel = true, bool inlinePropertyLabels = false) { Clear(); Dictionary <string, List <GraphParameterValue> > sorter = new Dictionary <string, List <GraphParameterValue> >(); //create a copy foreach (var p in values) { if (p.IsFunction()) { continue; } string sec = p.Section; if (string.IsNullOrEmpty(sec)) { sec = Properties.Resources.GRAPH_Default; } //try and convert name to localized string //convert the section name to localized string var rm = Properties.Resources.ResourceManager; string key = "GRAPH_" + sec.Replace(" ", "_"); try { string loc = rm.GetString(key); if (!string.IsNullOrEmpty(loc)) { sec = loc; } } catch (Exception e) { } List <GraphParameterValue> items = null; if (sorter.TryGetValue(sec, out items)) { items.Add(p); } else { items = new List <GraphParameterValue>(); items.Add(p); sorter[sec] = items; } } List <string> keys = sorter.Keys.ToList(); keys.Sort(); foreach (string k in keys) { List <GraphParameterValue> items = sorter[k]; if (showLabel) { PropertySection sect = new PropertySection(); sect.Title = k; if (!Stack.Children.Contains(sect) && sect.Parent == null) { Stack.Children.Add(sect); } foreach (var v in items) { EditableAttribute ed = new EditableAttribute(GetParamInputType(v), v.Name, v.Section, v.Min, v.Max); UIElement ele = BuildParamater(v, ed, v.GetType().GetProperty("Value")); if (ele != null) { string name = v.Name; //try and convert name to localized string //convert the section name to localized string var rm = Properties.Resources.ResourceManager; string key = "GRAPH_" + name.Replace(" ", "_"); try { string loc = rm.GetString(key); if (!string.IsNullOrEmpty(loc)) { name = loc; } } catch (Exception e) { } PropertyLabel lbl = new PropertyLabel(name, n, "$Custom." + v.Name); if (!inlinePropertyLabels) { sect.Add(lbl); sect.Add(ele); } else { StackPanelAuto inlinePanel = new StackPanelAuto(); inlinePanel.Direction = Orientation.Horizontal; inlinePanel.HalfAndHalf = true; inlinePanel.Children.Add(lbl); inlinePanel.Children.Add(ele); sect.Add(inlinePanel); } } } } else { foreach (var v in items) { EditableAttribute ed = new EditableAttribute(GetParamInputType(v), v.Name, v.Section, v.Min, v.Max); UIElement ele = BuildParamater(v, ed, v.GetType().GetProperty("Value")); if (ele != null) { string name = v.Name; //try and convert name to localized string //convert the section name to localized string var rm = Properties.Resources.ResourceManager; string key = "GRAPH_" + name.Replace(" ", "_"); try { string loc = rm.GetString(key); if (!string.IsNullOrEmpty(loc)) { name = loc; } } catch (Exception e) { } PropertyLabel lbl = new PropertyLabel(name, n, "$Custom." + v.Name); if (!inlinePropertyLabels) { Stack.Children.Add(lbl); Stack.Children.Add(ele); } else { StackPanelAuto inlinePanel = new StackPanelAuto(); inlinePanel.Direction = Orientation.Horizontal; inlinePanel.HalfAndHalf = true; inlinePanel.Children.Add(lbl); inlinePanel.Children.Add(ele); Stack.Children.Add(inlinePanel); } } } } } }
void CreateUIElement(Type t, PropertyInfo p, string name) { DropdownAttribute dp = p.GetCustomAttribute <DropdownAttribute>(); LevelEditorAttribute le = p.GetCustomAttribute <LevelEditorAttribute>(); CurveEditorAttribute ce = p.GetCustomAttribute <CurveEditorAttribute>(); SliderAttribute sl = p.GetCustomAttribute <SliderAttribute>(); FileSelectorAttribute fsl = p.GetCustomAttribute <FileSelectorAttribute>(); HidePropertyAttribute hp = p.GetCustomAttribute <HidePropertyAttribute>(); ColorPickerAttribute cp = p.GetCustomAttribute <ColorPickerAttribute>(); TitleAttribute ti = p.GetCustomAttribute <TitleAttribute>(); TextInputAttribute tinp = p.GetCustomAttribute <TextInputAttribute>(); GraphParameterEditorAttribute gpe = p.GetCustomAttribute <GraphParameterEditorAttribute>(); ParameterMapEditorAttribute pme = p.GetCustomAttribute <ParameterMapEditorAttribute>(); PromoteAttribute pro = p.GetCustomAttribute <PromoteAttribute>(); ParameterEditorAttribute pe = p.GetCustomAttribute <ParameterEditorAttribute>(); GraphFunctionEditorAttribute fe = p.GetCustomAttribute <GraphFunctionEditorAttribute>(); //handle very special stuff //exposed constant parameter variable names if (gpe != null) { if (node is Graph && !(node is FunctionGraph)) { Graph g = node as Graph; GraphParameterEditor inp = new GraphParameterEditor(g, g.Parameters); Stack.Children.Add(inp); elementLookup[name] = inp; } } //handle special custom parameter editing else if (pe != null) { if (node is Graph && !(node is FunctionGraph)) { Graph g = node as Graph; CustomParameterEditor inp = new CustomParameterEditor(g); Stack.Children.Add(inp); elementLookup[name] = inp; } } else if (fe != null) { if (node is Graph && !(node is FunctionGraph)) { Graph g = node as Graph; CustomFunctionEditor inp = new CustomFunctionEditor(g); Stack.Children.Add(inp); elementLookup[name] = inp; } } //for graph instance exposed parameters from underlying graph else if (pme != null) { if (node is GraphInstanceNode) { GraphInstanceNode gin = node as GraphInstanceNode; if (p.PropertyType.Equals(typeof(List <GraphParameterValue>))) { ParameterMap pm = new ParameterMap(gin.CustomParameters); Stack.Children.Add(pm); elementLookup[name] = pm; } else { ParameterMap pm = new ParameterMap(gin.Parameters); Stack.Children.Add(pm); elementLookup[name] = pm; } } } string title = name; if (ti != null) { title = ti.Title; } PropertyInfo op = null; //we don't create an element for this one //as it is hidden if (hp != null) { return; } try { if (ce != null) { op = node.GetType().GetProperty(ce.OutputProperty); } } catch (Exception e) { Console.WriteLine(e.StackTrace); } if (t.Equals(typeof(Gradient))) { var l = new PropertyLabel(); l.Title = title; labels.Add(l); Stack.Children.Add(l); GradientEditor inp = new GradientEditor(p, node); Stack.Children.Add(inp); elementLookup[name] = inp; } else if (t.Equals(typeof(MVector))) { if (cp != null) { PropertyLabel l = null; if (pro != null && node is Node) { l = new PropertyLabel(title, node as Node, name); } else { l = new PropertyLabel(); l.Title = title; } labels.Add(l); Stack.Children.Add(l); ColorSelect cs = new ColorSelect(p, node); Stack.Children.Add(cs); elementLookup[name] = cs; } } else if (t.Equals(typeof(string[]))) { if (dp != null) { PropertyLabel l = new PropertyLabel(); l.Title = title; labels.Add(l); Stack.Children.Add(l); DropDown inp = new DropDown((string[])p.GetValue(node), node, p, dp.OutputProperty); Stack.Children.Add(inp); elementLookup[name] = inp; } } else if (t.Equals(typeof(bool))) { PropertyLabel l = null; if (pro != null && node is Node) { l = new PropertyLabel(title, node as Node, name); } else { l = new PropertyLabel(); l.Title = title; } labels.Add(l); Stack.Children.Add(l); ToggleControl tg = new ToggleControl(name, p, node); Stack.Children.Add(tg); elementLookup[name] = tg; } else if (t.Equals(typeof(string))) { if (tinp != null) { PropertyLabel l = new PropertyLabel(); l.Title = title; labels.Add(l); Stack.Children.Add(l); PropertyInput ip = new PropertyInput(p, node); Stack.Children.Add(ip); elementLookup[name] = ip; } else if (fsl != null) { PropertyLabel l = new PropertyLabel(); l.Title = title; labels.Add(l); Stack.Children.Add(l); FileSelector inp = new FileSelector(p, node, fsl.Filter); Stack.Children.Add(inp); elementLookup[name] = inp; } else if (dp != null) { PropertyLabel l = new PropertyLabel(); l.Title = title; labels.Add(l); Stack.Children.Add(l); object[] names = dp.Values; DropDown inp = new DropDown(names, node, p, dp.OutputProperty); Stack.Children.Add(inp); elementLookup[name] = inp; } } else if (t.Equals(typeof(float))) { if (sl != null) { PropertyLabel l = null; if (pro != null && node is Node) { l = new PropertyLabel(title, node as Node, name); } else { l = new PropertyLabel(); l.Title = title; } labels.Add(l); Stack.Children.Add(l); NumberSlider inp = new NumberSlider(sl, p, node); Stack.Children.Add(inp); elementLookup[name] = inp; } else { PropertyLabel l = null; if (pro != null && node is Node) { l = new PropertyLabel(title, node as Node, name); } else { l = new PropertyLabel(); l.Title = title; } labels.Add(l); Stack.Children.Add(l); NumberInput inp = new NumberInput(NumberInputType.Float, node, p); Stack.Children.Add(inp); elementLookup[name] = inp; } } else if (t.Equals(typeof(int))) { if (dp != null) { PropertyLabel l = new PropertyLabel(); l.Title = title; labels.Add(l); Stack.Children.Add(l); //do a dropdown object[] names = dp.Values; DropDown inp = new DropDown(names, node, p, dp.OutputProperty); Stack.Children.Add(inp); elementLookup[name] = inp; } else if (sl != null) { PropertyLabel l = null; if (pro != null && node is Node) { l = new PropertyLabel(title, node as Node, name); } else { l = new PropertyLabel(); l.Title = title; } labels.Add(l); Stack.Children.Add(l); NumberSlider inp = new NumberSlider(sl, p, node); Stack.Children.Add(inp); elementLookup[name] = inp; } else { PropertyLabel l = null; if (pro != null && node is Node) { l = new PropertyLabel(title, node as Node, name); } else { l = new PropertyLabel(); l.Title = title; } labels.Add(l); Stack.Children.Add(l); NumberInput inp = new NumberInput(NumberInputType.Int, node, p); Stack.Children.Add(inp); elementLookup[name] = inp; } } else if (t.Equals(typeof(MultiRange))) { if (le != null) { UILevels lv = null; if (node is Node) { Node nd = (Node)node; if (nd.Inputs.Count > 0 && nd.Inputs[0].Input != null) { var n = nd.Inputs[0].Input.Node; byte[] result = n.GetPreview(n.Width, n.Height); RawBitmap bit = null; if (result != null) { bit = new RawBitmap(n.Width, n.Height, result); } lv = new UILevels(bit, node, p); } else { lv = new UILevels(null, node, p); } Stack.Children.Add(lv); elementLookup[name] = lv; } } } else if (op != null && ce != null) { UICurves cv = new UICurves(p, op, node); Stack.Children.Add(cv); elementLookup[name] = cv; } else if (t.IsEnum) { PropertyLabel l = new PropertyLabel(); l.Title = title; labels.Add(l); Stack.Children.Add(l); string[] names = Enum.GetNames(t); DropDown inp = new DropDown(names, node, p); Stack.Children.Add(inp); elementLookup[name] = inp; } }