/// <summary> /// This should launch an open file dialog instead of the usual thing. /// </summary> /// <param name="context">System.ComponentModel.ITypeDescriptorContext</param> /// <param name="provider">IServiceProvider</param> /// <param name="value">The object being displayed</param> /// <returns>A new version of the object if the dialog was ok.</returns> public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, IServiceProvider provider, object value) { _context = context; _original = value as IPolygonScheme; _editCopy = _original.Copy(); IWindowsFormsEditorService dialogProvider = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)); NamedList<IPolygonCategory> cats = new NamedList<IPolygonCategory>(_editCopy.Categories, "Category"); CollectionPropertyGrid frm = new CollectionPropertyGrid(cats); frm.ChangesApplied += new EventHandler(frm_ChangesApplied); frm.AddItemClicked += new EventHandler(frm_AddItemClicked); dialogProvider.ShowDialog(frm); return _original; // don't bother swapping out the edit copy, just store copies of the categories when changes are applied. }
/// <summary> /// This describes how to launch the form etc. /// </summary> /// <param name="context"></param> /// <param name="provider"></param> /// <param name="value"></param> /// <returns></returns> public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, IServiceProvider provider, object value) { _context = context; IWindowsFormsEditorService dialogProvider = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)); SQLExpressionDialog dlgExpression = new SQLExpressionDialog(); string original = (string)value; dlgExpression.Expression = (string)value; // Try to find the Table IFeatureCategory category = context.Instance as IFeatureCategory; if (category != null) { IFeatureScheme scheme = category.GetParentItem() as IFeatureScheme; if (scheme != null) { IFeatureLayer layer = scheme.GetParentItem() as IFeatureLayer; if (layer != null) { dlgExpression.Table = layer.DataSet.DataTable; } } else { IFeatureLayer layer = category.GetParentItem() as IFeatureLayer; if (layer != null) { dlgExpression.Table = layer.DataSet.DataTable; } } } dlgExpression.ChangesApplied += dlgExpression_ChangesApplied; if (dialogProvider.ShowDialog(dlgExpression) != System.Windows.Forms.DialogResult.OK) { return original; } else { return dlgExpression.Expression; } }
public override bool GetCreateInstanceSupported(System.ComponentModel.ITypeDescriptorContext context) { throw null; }
public override object ConvertTo(System.ComponentModel.ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, System.Type destinationType) { throw null; }
public override bool CanConvertFrom(System.ComponentModel.ITypeDescriptorContext context, System.Type sourceType) { throw null; }
/// <summary> /// Returns whether this object supports a standard set of values that can be picked from a list, using the specified context. /// </summary> /// <param name="context">An <see cref="T:System.ComponentModel.ITypeDescriptorContext"></see> that provides a format context.</param> /// <returns> /// true if <see cref="M:System.ComponentModel.TypeConverter.GetStandardValues"></see> should be called to find a common set of values the object supports; otherwise, <c>false</c>. /// </returns> public override bool GetStandardValuesSupported(System.ComponentModel.ITypeDescriptorContext context) { return(this.baseTypeConverter.GetStandardValuesSupported(context)); }
/// <summary> /// Returns a collection of properties for the type of array specified by the value parameter, using the specified context and attributes. /// </summary> /// <param name="context">An <see cref="T:System.ComponentModel.ITypeDescriptorContext"></see> that provides a format context.</param> /// <param name="value">An <see cref="T:System.Object"></see> that specifies the type of array for which to get properties.</param> /// <param name="attributes">An array of type <see cref="T:System.Attribute"></see> that is used as a filter.</param> /// <returns> /// A <see cref="T:System.ComponentModel.PropertyDescriptorCollection"></see> with the properties that are exposed for this data type, or null if there are no properties. /// </returns> public override System.ComponentModel.PropertyDescriptorCollection GetProperties(System.ComponentModel.ITypeDescriptorContext context, object value, Attribute[] attributes) { return(this.baseTypeConverter.GetProperties(context, value, attributes)); }
/// <summary> /// Creates an instance of the type that this <see cref="T:System.ComponentModel.TypeConverter"></see> is associated with, using the specified context, given a set of property values for the object. /// </summary> /// <param name="context">An <see cref="T:System.ComponentModel.ITypeDescriptorContext"></see> that provides a format context.</param> /// <param name="propertyValues">An <see cref="T:System.Collections.IDictionary"></see> of new property values.</param> /// <returns> /// An <see cref="T:System.Object"></see> representing the given <see cref="T:System.Collections.IDictionary"></see>, or <c>null</c> if the object can not be created. /// This method always returns <c>null</c>. /// </returns> public override object CreateInstance(System.ComponentModel.ITypeDescriptorContext context, System.Collections.IDictionary propertyValues) { return(baseTypeConverter.CreateInstance(context, propertyValues)); }
public virtual bool GetPropertiesSupported(System.ComponentModel.ITypeDescriptorContext context) { }
public virtual System.ComponentModel.PropertyDescriptorCollection GetProperties(System.ComponentModel.ITypeDescriptorContext context, object value, System.Attribute[] attributes) { }
public virtual bool GetCreateInstanceSupported(System.ComponentModel.ITypeDescriptorContext context) { }
public virtual object CreateInstance(System.ComponentModel.ITypeDescriptorContext context, System.Collections.IDictionary propertyValues) { }
public virtual object ConvertTo(System.ComponentModel.ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType) { }
public virtual bool GetStandardValuesSupported(System.ComponentModel.ITypeDescriptorContext context) { }
public virtual bool GetStandardValuesExclusive(System.ComponentModel.ITypeDescriptorContext context) { }
public virtual System.ComponentModel.TypeConverter.StandardValuesCollection GetStandardValues(System.ComponentModel.ITypeDescriptorContext context) { }
/// <summary> /// Returns whether this converter can convert the object to the specified type, using the specified context. /// </summary> /// <param name="context">An <see cref="T:System.ComponentModel.ITypeDescriptorContext"></see> that provides a format context.</param> /// <param name="destinationType">A <see cref="T:System.Type"></see> that represents the type you want to convert to.</param> /// <returns> /// true if this converter can perform the conversion; otherwise, <c>false</c>. /// </returns> public override bool CanConvertTo(System.ComponentModel.ITypeDescriptorContext context, Type destinationType) { return((destinationType == typeof(string)) || baseTypeConverter.CanConvertTo(context, destinationType)); }
public virtual bool IsValid(System.ComponentModel.ITypeDescriptorContext context, object value) { }
/// <summary> /// Returns whether changing a value on this object requires a call to <see cref="M:System.ComponentModel.TypeConverter.CreateInstance(System.Collections.IDictionary)"></see> to create a new value, using the specified context. /// </summary> /// <param name="context">An <see cref="T:System.ComponentModel.ITypeDescriptorContext"></see> that provides a format context.</param> /// <returns> /// true if changing a property on this object requires a call to <see cref="M:System.ComponentModel.TypeConverter.CreateInstance(System.Collections.IDictionary)"></see> to create a new value; otherwise, <c>false</c>. /// </returns> public override bool GetCreateInstanceSupported(System.ComponentModel.ITypeDescriptorContext context) { return(this.baseTypeConverter.GetCreateInstanceSupported(context)); }
public virtual bool CanConvertTo(System.ComponentModel.ITypeDescriptorContext context, Type destinationType) { }
/// <summary> /// Returns a collection of standard values for the data type this type converter is designed for when provided with a format context. /// </summary> /// <param name="context">An <see cref="T:System.ComponentModel.ITypeDescriptorContext"></see> that provides a format context that can be used to extract additional information about the environment from which this converter is invoked. This parameter or properties of this parameter can be null.</param> /// <returns> /// A <see cref="T:System.ComponentModel.TypeConverter.StandardValuesCollection"></see> that holds a standard set of valid values, or null if the data type does not support a standard set of values. /// </returns> public override StandardValuesCollection GetStandardValues(System.ComponentModel.ITypeDescriptorContext context) { return(this.baseTypeConverter.GetStandardValues(context)); }
// Methods public virtual bool CanConvertFrom(System.ComponentModel.ITypeDescriptorContext context, Type sourceType) { }
public override bool GetPropertiesSupported(System.ComponentModel.ITypeDescriptorContext context) { throw null; }
public object ConvertFromString(System.ComponentModel.ITypeDescriptorContext context, string text) { }
public override bool CanConvertTo(System.ComponentModel.ITypeDescriptorContext context, System.Type destinationType) { throw null; }
public object ConvertFromString(System.ComponentModel.ITypeDescriptorContext context, System.Globalization.CultureInfo culture, string text) { }
public override object CreateInstance(System.ComponentModel.ITypeDescriptorContext context, System.Collections.IDictionary propertyValues) { throw null; }
public string ConvertToInvariantString(System.ComponentModel.ITypeDescriptorContext context, object value) { }
public override System.ComponentModel.PropertyDescriptorCollection GetProperties(System.ComponentModel.ITypeDescriptorContext context, object value, System.Attribute[] attributes) { throw null; }
/// <summary> /// 获取由 EditValue 方法使用的编辑器样式 /// </summary> /// <param name="context">可用于获取附加上下文信息的 ITypeDescriptorContext</param> /// <returns>UITypeEditorEditStyle 值,指示 EditValue 方法使用的编辑器样式。 如果 UITypeEditor 不支持该方法,则 GetEditStyle 将返回 None</returns> public override UITypeEditorEditStyle GetEditStyle(System.ComponentModel.ITypeDescriptorContext context) { return(UITypeEditorEditStyle.Modal); }
/// <summary> /// Returns whether this converter can convert an object of the given type to the type of this converter, using the specified context. /// </summary> /// <param name="context">An <see cref="T:System.ComponentModel.ITypeDescriptorContext"></see> that provides a format context.</param> /// <param name="sourceType">A <see cref="T:System.Type"></see> that represents the type you want to convert from.</param> /// <returns> /// true if this converter can perform the conversion; otherwise, <c>false</c>. /// </returns> public override bool CanConvertFrom(System.ComponentModel.ITypeDescriptorContext context, Type sourceType) { return((sourceType == typeof(string)) || baseTypeConverter.CanConvertFrom(context, sourceType)); }
public System.ComponentModel.PropertyDescriptorCollection GetProperties(System.ComponentModel.ITypeDescriptorContext context, object value) { }