Beispiel #1
0
        public static Control GenerateAttributeControl(string name, DocumentManipulation.Attribute attribute)
        {
            switch (attribute.Type)
            {
            case "Text":
                return(new TextControl((TextAttribute)attribute));

            case "TextArea":
                return(new TextAreaControl((TextAttribute)attribute));

            case "Bit":
                return(new BitControl((BitAttribute)attribute));

            case "Label":
                return(new LabelControl((LabelAttribute)attribute));

            case "Enum":
                return(new EnumControl((EnumAttribute)attribute));

            case "Image":
                return(new ImageControl((ImageAttribute)attribute));

            case "File":
                return(new FileControl((FileAttribute)attribute));
            }

            return(null);
        }
Beispiel #2
0
        public EnumControl(EnumAttribute attribute)
        {
            InitializeComponent();
            Label.Content = attribute.Label;
            this.SetValue(Grid.RowProperty, attribute.Row);
            this.SetValue(Grid.ColumnProperty, attribute.Column);
            this.SetValue(Grid.ColumnSpanProperty, attribute.ColumnSpan);

            foreach (var val in attribute.Values.Keys)
            {
                var radioButton = new RadioButton();
                radioButton.Content = val;
                radioButton.Click  += new RoutedEventHandler(RadioButton_Click);
                if (val == attribute.Value)
                {
                    radioButton.IsChecked = true;
                }
                RadioGroup.Children.Add(radioButton);
            }
            _attribute = attribute;
        }