Exemplo n.º 1
0
        public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
        {
            if (destinationType == typeof(string))
            {
                if (value == null)
                {
                    return(String.Empty);
                }

                if (_name != null)
                {
                    return(_name);
                }

                return(WrappedPropertyDescriptor.GetName(context));
            }

            return(base.ConvertTo(context, culture, value, destinationType));
        }
Exemplo n.º 2
0
        public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
        {
            if (value == null)
            {
                return(String.Empty);
            }

            if (value is ICustomTypeDescriptor desc)
            {
                value = desc.GetPropertyOwner(null);
            }

            var list = (System.Collections.IDictionary)value;

            if (list.Count == 0)
            {
                return("(None)");
            }

            return(WrappedPropertyDescriptor.GetName(context));
        }