public void AddMetaCheckBox(string name) { StackPanel panel = new StackPanel(); panel.Orientation = Orientation.Horizontal; panel.HorizontalAlignment = HorizontalAlignment.Stretch; panel.Margin = new Thickness(0, 4, 4, 4); CheckBox checkbox = new CheckBox(); checkbox.Content = name; checkbox.Name = name + "_CheckBox"; checkbox.HorizontalAlignment = HorizontalAlignment.Right; checkbox.Margin = new Thickness(8, 0, 4, 0); checkbox.Foreground = this.FindResource(SystemColors.WindowBrushKey) as Brush; panel.Children.Add(checkbox); if (NameScope.GetNameScope(checkbox) == null) { NameScope.SetNameScope(checkbox, new NameScope()); } NameScope.GetNameScope(checkbox).RegisterName(checkbox.Name, checkbox); metaPanel.Children.Add(panel); SpecifierData data = new SpecifierData(); data.Type = ESpecifierType.TYPE_BOOL; data.Name = name; data.checkBox = checkbox; data.WithinMeta = true; // All checkboxes are presumed WithinMeta given that, otherwise, they would be standard specifiers m_Data.Add(name, data); }
public void AddMetaTextBox(string name, bool isMeta = true, bool quotedValue = true, bool enclosed = false) { StackPanel panel = new StackPanel(); panel.Orientation = Orientation.Horizontal; panel.HorizontalAlignment = HorizontalAlignment.Stretch; panel.Margin = new Thickness(0, 4, 4, 4); Label label = new Label(); label.Content = name; label.Foreground = this.FindResource(SystemColors.WindowBrushKey) as Brush; label.HorizontalAlignment = HorizontalAlignment.Left; label.Width = 120.0; label.Margin = new Thickness(4, 0, 4, 0); TextBox textBox = new TextBox(); textBox.Name = name + "_TextBox"; textBox.HorizontalAlignment = HorizontalAlignment.Right; textBox.Width = 130.0; textBox.MinWidth = 130.0; textBox.MaxWidth = 130.0; textBox.Margin = new Thickness(0, 0, 4, 0); panel.Children.Add(label); panel.Children.Add(textBox); //panel.RegisterName(textBox.Name, textBox); if (NameScope.GetNameScope(textBox) == null) { NameScope.SetNameScope(textBox, new NameScope()); } NameScope.GetNameScope(textBox).RegisterName(textBox.Name, textBox); metaPanel.Children.Add(panel); SpecifierData data = new SpecifierData(); data.Type = ESpecifierType.TYPE_STRING; data.Name = name; data.textBox = textBox; data.Quoted = quotedValue; data.WithinMeta = isMeta; data.Enclosed = enclosed; m_Data.Add(name, data); }