/// <returns>true if the <see cref="T:System.ComponentModel.TypeConverter.StandardValuesCollection" /> returned from <see cref="M:System.ComponentModel.TypeConverter.GetStandardValues" /> is an exhaustive list of possible values; false if other values are possible.</returns> /// <param name="context">An <see cref="T:System.ComponentModel.ITypeDescriptorContext" /> that provides a format context.</param> public override bool GetStandardValuesExclusive(ITypeDescriptorContext context) { if (underlyingTypeConverter != null) { return(underlyingTypeConverter.GetStandardValuesExclusive(context)); } return(base.GetStandardValuesExclusive(context)); }
private void OnLoadingTypeConverter() { StandardValues = null; StandardValuesExclusive = false; //Populate properties using TypeConverter if (m_TypeConverter != null) { StandardValues = m_TypeConverter.GetStandardValues(); if (StandardValues != null && StandardValues.Count > 0) { StandardValuesExclusive = m_TypeConverter.GetStandardValuesExclusive(); } else { StandardValuesExclusive = false; } } }
/// <summary> /// Initializes a new instance of the <see cref="ValidatorTypeConverter"/> class. /// </summary> /// <param name="type">Can not be null.</param> /// <param name="typeConverter">Can be null to don't allow any conversion.</param> public ValidatorTypeConverter(Type type, TypeConverter typeConverter) : base(type) { this.typeConverter = typeConverter; // Populate properties using TypeConverter if (typeConverter != null) { StandardValues = typeConverter.GetStandardValues(); if (StandardValues != null && StandardValues.Count > 0) { StandardValuesExclusive = typeConverter.GetStandardValuesExclusive(); } else { StandardValuesExclusive = false; } } }
/// <summary> /// Creates a new drop-down control to display the given TypeConverter /// </summary> /// <param name="typeConverter">The TypeConverter instance to retrieve drop-down values from</param> /// <param name="propertyDescriptor">Property descriptor used to get/set values in the drop-down.</param> /// <param name="instance">Instance object used to get/set values in the drop-down.</param> protected internal TypeEditorHostListBox(TypeConverter typeConverter, PropertyDescriptor propertyDescriptor, object instance) : this( typeConverter, propertyDescriptor, instance, (typeConverter != null && typeConverter.GetStandardValuesExclusive()) ? TypeEditorHostEditControlStyle.ReadOnlyEdit : TypeEditorHostEditControlStyle.Editable) { }
public void CheckStandardValuesExclusive(bool expect, TypeConverter conv) { bool result; result = conv.GetStandardValuesExclusive(null); if (result != expect) { failed++; if (verbose > 0) { Console.WriteLine("{0}: GetStandardValuesExclusive expected {1}, returned {2}", conv.ToString(), expect, result); } } }
/// <summary> /// Returns whether the collection of standard values returned from <see cref="M:System.ComponentModel.TypeConverter.GetStandardValues"></see> is an exclusive list of possible values, 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 the <see cref="T:System.ComponentModel.TypeConverter.StandardValuesCollection"></see> returned from <see cref="M:System.ComponentModel.TypeConverter.GetStandardValues"></see> is an exhaustive list of possible values; false if other values are possible. /// </returns> public override bool GetStandardValuesExclusive(System.ComponentModel.ITypeDescriptorContext context) { return(baseTypeConverter.GetStandardValuesExclusive(context)); }