public ImageVaueEditor(PropertyGridLabel label, PropertyItem property) : base(label, property) { property.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(property_PropertyChanged); property.ValueError += new EventHandler<ExceptionEventArgs>(property_ValueError); _attribute = property.GetAttribute<ImageAttribute>(); if(null == _attribute) { _attribute = new ImageAttribute(); _attribute.OnlyImage = false; } _grid.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1d, GridUnitType.Auto) }); _grid.ColumnDefinitions.Add(new ColumnDefinition()); _grid.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1d, GridUnitType.Auto) }); _grid.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1d, GridUnitType.Auto) }); _grid.Children.Add(_image); _grid.Children.Add(_text); _grid.Children.Add(_removeButton); _grid.Children.Add(_broswerButton); _image.SetValue(Grid.ColumnProperty, 0); _text.SetValue(Grid.ColumnProperty, 1); _removeButton.SetValue(Grid.ColumnProperty, 2); _broswerButton.SetValue(Grid.ColumnProperty, 3); this.Content = _grid; _broswerButton.Click += BroswerButton_Click; _removeButton.Click += RemoveButton_Click; UpdateLabel(property.Value); _text.GotFocus += Text_GotFocus; _text.Background = null; _text.BorderBrush = null; _text.BorderThickness = new Thickness(); }
public StringValueEditor(PropertyGridLabel label, PropertyItem property) : base(label, property) { if (property.PropertyType == typeof(Char)) { if ((char)property.Value == '\0') property.Value = ""; } property.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(property_PropertyChanged); property.ValueError += new EventHandler<ExceptionEventArgs>(property_ValueError); txt = new TextBox(); txt.Height = 20; if (null != property.Value) txt.Text = property.Value.ToString(); //txt.IsReadOnly = !this.Property.CanWrite; txt.Foreground = this.Property.CanWrite ? new SolidColorBrush(Colors.Black) : new SolidColorBrush(Colors.Gray); txt.BorderThickness = new Thickness(0); txt.Margin = new Thickness(0); if (this.Property.CanWrite) txt.TextChanged += new TextChangedEventHandler(Control_TextChanged); this.Content = txt; this.GotFocus += new RoutedEventHandler(StringValueEditor_GotFocus); }
/// <summary> /// Constructor /// </summary> /// <param name="label">The associated label for this Editor control</param> /// <param name="property">The associated PropertyItem for this control</param> public ValueEditorBase(PropertyGridLabel label, PropertyItem property) { this.Label = label; this.Label.MouseLeftButtonDown += new System.Windows.Input.MouseButtonEventHandler(Label_MouseLeftButtonDown); this.Label.MouseLeftButtonUp += new System.Windows.Input.MouseButtonEventHandler(Label_MouseLeftButtonUp); if (!property.CanWrite) this.Label.Foreground = new SolidColorBrush(Colors.Gray); this.Property = property; this.BorderThickness = new Thickness(0); this.Margin = new Thickness(0); this.HorizontalAlignment = HorizontalAlignment.Stretch; this.HorizontalContentAlignment = HorizontalAlignment.Stretch; }
public FontFamilyValueEditor(PropertyGridLabel label, PropertyItem property) : base(label, property) { property.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(property_PropertyChanged); property.ValueError += new EventHandler<ExceptionEventArgs>(property_ValueError); this.Content = _combox; _combox.ItemsSource = Fonts; _combox.SelectedValuePath = "Value"; _combox.DisplayMemberPath = "DisplayName"; _combox.SelectionChanged += ComboBox_SelectionChanged; var fontFamily = property.Value as FontFamily; _combox.SelectedItem = new Font(Common1.GetFontCN(fontFamily.Source), fontFamily); }
public ColorValueEditor(PropertyGridLabel label, PropertyItem property) : base(label, property) { property.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(property_PropertyChanged); property.ValueError += new EventHandler<ExceptionEventArgs>(property_ValueError); this.Content = _colorPicker; _colorPicker.ColorChanged += colorPicker_ColorChanged; if (property.Value is SolidColorBrush) { currentValue = _colorPicker.Color = (property.Value as SolidColorBrush).Color; } if (property.Value is Color) { currentValue =_colorPicker.Color = (Color)property.Value; } }
/// <summary> /// Constructor /// </summary> /// <param name="label"></param> /// <param name="property"></param> public DateTimeValueEditor(PropertyGridLabel label, PropertyItem property) : base(label, property) { currentValue = property.Value; property.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(property_PropertyChanged); property.ValueError += new EventHandler<ExceptionEventArgs>(property_ValueError); pnl = new StackPanel(); this.Content = pnl; dtp = new DatePicker(); dtp.Visibility = Visibility.Visible; dtp.Margin = new Thickness(0); dtp.VerticalAlignment = VerticalAlignment.Center; dtp.HorizontalAlignment = HorizontalAlignment.Stretch; dtp.CalendarOpened += new RoutedEventHandler(dtp_CalendarOpened); dtp.CalendarClosed += new RoutedEventHandler(dtp_CalendarClosed); dtp.LostFocus += new RoutedEventHandler(dtp_LostFocus); pnl.Children.Add(dtp); dtp.Focus(); this.ShowTextBox(); }
public EnumValueEditor(PropertyGridLabel label, PropertyItem property) : base(label, property) { }
public BooleanValueEditor(PropertyGridLabel label, PropertyItem property) : base(label, property) { }
static Border GetItemLabel(PropertyGridLabel label, string tagValue) { return new Border() { Name = "N" + Guid.NewGuid().ToString("N"), Margin = new Thickness(0), BorderBrush = new SolidColorBrush(backgroundColor), BorderThickness = new Thickness(0, 0, 1, 1), Child = label, Tag = tagValue }; }