//private SelectValueEditorAttribute _attrs = null; /// <summary> /// Данный конструктор используется в динамических PropertyGrid, на событии OnCustomEditor /// </summary> /// <param name="label"></param> /// <param name="property"></param> /// <param name="attrs"></param> public SelectValueEditor(PropertyGridLabel label, PropertyItem property, SelectValueEditorAttribute attrs) : base(label, property) { var v_attrs = attrs ?? this.Property.GetAttribute<SelectValueEditorAttribute>(); this.SelectorPlugin = v_attrs.SelectorPluginName; this.DisplayField = v_attrs.DisplayFieldName; this.ValueField = v_attrs.ValueFieldName; this.IsMultiselector = v_attrs.isMultiselector; }
private PropertyGridLabel CreateLabel(int rowIndex, PropertyItem item) { PropertyGridLabel label = new PropertyGridLabel() { Text = item.Property.DisplayName }; Grid.SetColumn(label, 1); Grid.SetRow(label, rowIndex); return(label); }
/// <summary> /// Constructor /// </summary> /// <param name="label"></param> /// <param name="property"></param> public ComboBoxEditorBase(PropertyGridLabel label, PropertyItem property) : base(label, property) { }
/// <summary> /// Данный конструктор используется в статических PropertyGrid /// </summary> /// <param name="label"></param> /// <param name="property"></param> public SelectValueEditor(PropertyGridLabel label, PropertyItem property) : this(label, property, null) { }
public TextBlockEditor(PropertyGridLabel label, PropertyItem property) : base(label, property) { }
public BooleanValueEditor(PropertyGridLabel label, PropertyItem property) : base(label, property) { }
private void _doOnCustomEditor(PropertyGridLabel label, PropertyItem item, ref PropertyEditor editor) { var eve = this.OnCustomEditor; if (eve != null) { var args = new OnCustomEditorEventArgs() { Label = label, Editor = editor }; eve(item, args); editor = args.Editor; } }
public ComboBoxRmtEditor(PropertyGridLabel label, PropertyItem property, ComboBoxRmtEditorAttribute attrs) : base(label, property) { this._attrs = attrs ?? this.Property.GetAttribute<ComboBoxRmtEditorAttribute>(); }
/// <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 PropertyEditor(PropertyGridLabel label, PropertyItem property) { this.Label = label; this.Property = property; this.Property.Editor = this; }
/// <summary> /// Данный конструктор используется в статических PropertyGrid /// </summary> /// <param name="label"></param> /// <param name="property"></param> public ASelectorValueControl(PropertyGridLabel label, PropertyItem property) : base(label, property) { }
private static PropertyEditor _getEditorByType(Type propertyType, PropertyGridLabel label, PropertyItem property) { if (typeof(Boolean).IsAssignableFrom(propertyType) || typeof(Boolean?).IsAssignableFrom(propertyType)) return new BooleanValueEditor(label, property); if (typeof(Enum).IsAssignableFrom(propertyType)) return new EnumValueEditor(label, property); if (typeof(DateTime).IsAssignableFrom(propertyType) || typeof(DateTime?).IsAssignableFrom(propertyType)) return new DateValueEditor(label, property); if (typeof(String).IsAssignableFrom(propertyType)) return new StringValueEditor(label, property); if (typeof(ValueType).IsAssignableFrom(propertyType)) return new StringValueEditor(label, property); //if (typeof(Object).IsAssignableFrom(propertyType)) // return new PropertyGrid(label, property); return new StringValueEditor(label, property); }
public static PropertyEditor GetEditor(PropertyGridLabel label, PropertyItem propertyItem) { if (propertyItem == null) throw new ArgumentNullException("propertyItem"); PropertyEditor v_editor = null; EditorAttribute attribute = propertyItem.GetAttribute<EditorAttribute>(); if (attribute != null) { ConstructorInfo ci = attribute.EditorType.GetConstructor(new Type[] { typeof(PropertyGridLabel), typeof(PropertyItem) }); v_editor = ci.Invoke(new Object[] { label, propertyItem }) as PropertyEditor; } if (v_editor == null) { Type propertyType = propertyItem.PropertyType; v_editor = _getEditorByType(propertyType, label, propertyItem); while (v_editor == null && propertyType.BaseType != null) { propertyType = propertyType.BaseType; v_editor = _getEditorByType(propertyType, label, propertyItem); } } return v_editor; }
public ComboBoxRmtEditor(PropertyGridLabel label, PropertyItem property):this(label, property, null) { }
private void CreateItem() { if (_categories.Count > 0) { int rowIndex = 0; PropertyGroupItem groupItem = null; Line gridLine = null; PropertyGridLabel label = null; ValueEditorBase editor = null; foreach (KeyValuePair <string, List <PropertyItem> > keyValuePair in _categories) { if (null != gridLine) { _mainGrid.Children.Remove(gridLine); } rowIndex = _mainGrid.RowDefinitions.Count; groupItem = new PropertyGroupItem(); groupItem.Content = keyValuePair.Key; Grid.SetRow(groupItem, rowIndex); Grid.SetColumnSpan(groupItem, 3); _mainGrid.Children.Add(groupItem); _mainGrid.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1d, GridUnitType.Auto) }); foreach (PropertyItem item in keyValuePair.Value) { rowIndex = _mainGrid.RowDefinitions.Count; gridLine = CreateHorizontalGridLine(rowIndex, groupItem.Background); label = CreateLabel(rowIndex, item); editor = ValueEditorServices.CreateValueEdiorBase(item); Grid.SetColumn(editor, 2); Grid.SetRow(editor, _mainGrid.RowDefinitions.Count); _editors.Add(item.Property.PropertyName, editor); groupItem.Items.Add(label); groupItem.Items.Add(editor); groupItem.Items.Add(gridLine); _mainGrid.Children.Add(label); _mainGrid.Children.Add(editor); _mainGrid.Children.Add(gridLine); _mainGrid.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1d, GridUnitType.Auto) }); } } Grid.SetRowSpan(_splitter, rowIndex + 1); Grid.SetRowSpan(_verticalLine, rowIndex + 1); _verticalLine.Stroke = groupItem.Background; _mainGrid.Children.Add(_splitter); _mainGrid.Children.Add(_verticalLine); _mainGrid.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1d, GridUnitType.Star) }); } }
static Border GetItemLabel(PropertyGridLabel label, string tagValue) { return new Border() { Name = Guid.NewGuid().ToString("N"), Margin = new Thickness(0), BorderBrush = new SolidColorBrush(backgroundColor), BorderThickness = new Thickness(0, 0, 1, 1), Child = label, Tag = tagValue }; }
public EnumValueEditor(PropertyGridLabel label, PropertyItem property) : base(label, property) { }
/// <summary> /// Constructor /// </summary> /// <param name="label"></param> /// <param name="property"></param> public DateTimeValueEditor(PropertyGridLabel label, PropertyItem property) : base(label, property) { }