Ejemplo n.º 1
0
        public TextualBasicValueEditor(ItemType valueType, IEnumerable<ValueValidatorAttribute> validators, XElement serializedDefaultValue)
            : base(valueType, validators, serializedDefaultValue)
        {
            basicValueType = (BasicItemType)ValueType;

            Grid grid = new Grid {
                ColumnDefinitions = {
                    new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) },
                    new ColumnDefinition { Width = new GridLength(1, GridUnitType.Auto) }
                }
            };
            Representation = grid;

            uiText = new TextBox();
            uiText.TextChanged += uiText_TextChanged;
            uiText.KeyDown += uiText_KeyDown;
            uiText.LostFocus += uiText_LostFocus;
            Grid.SetColumn(uiText, 0);
            grid.Children.Add(uiText);

            uiError = new Image {
                Margin = new Thickness(5, 0, 0, 0),
                Source = new System.Windows.Media.Imaging.BitmapImage(new Uri("pack://application:,,,/ObjectConfigurator;component/Resources/error.png")),
                Width = 18
            };
            Grid.SetColumn(uiError, 1);
            grid.Children.Add(uiError);

            CheckError();
        }
Ejemplo n.º 2
0
        public BooleanValueEditor(ItemType valueType, IEnumerable<ValueValidatorAttribute> validators, XElement serializedDefaultValue)
            : base(valueType, validators, serializedDefaultValue)
        {
            basicValueType = (BasicItemType)ValueType;

            uiValue = new CheckBox {
                Margin = new Thickness(3),
                IsChecked = (serializedDefaultValue.Value == true.ToString())
            };
            uiValue.Click += uiValue_Click;

            Representation = new Border { Child = uiValue };
        }