public override TypeConverter.StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
        {
            IPropertyValueProvider provider = null;

            object[] instance = context.Instance as object[];
            if ((instance != null) && (instance.Length > 0))
            {
                provider = instance[0] as IPropertyValueProvider;
            }
            else
            {
                provider = context.Instance as IPropertyValueProvider;
            }
            ICollection values = new object[0];

            if ((provider != null) && (context != null))
            {
                values = provider.GetPropertyValues(context);
            }
            return(new TypeConverter.StandardValuesCollection(values));
        }
示例#2
0
        // NOTE: Copied from PropertyValueProviderTypeConverter.
        // The purpose of this type converter is so that we can both provide standard values and
        // convert System.Type to string.
        public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
        {
            // grab all property values
            IPropertyValueProvider valuesProvider = null;

            object[] instances = context.Instance as object[];
            if (instances != null && instances.Length > 0)
            {
                valuesProvider = instances[0] as IPropertyValueProvider;
            }
            else
            {
                valuesProvider = context.Instance as IPropertyValueProvider;
            }

            ICollection values = new object[] { };

            if (valuesProvider != null && context != null)
            {
                values = valuesProvider.GetPropertyValues(context);
            }

            return(new StandardValuesCollection(values));
        }