Exemple #1
0
 public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
 {
     if (ConditionalAutoLengthConverter.IsSilverlightProject(context))
     {
         string str = value as string;
         if (str != null && ConditionalAutoLengthConverter.IsEquivalentToAuto(str))
         {
             throw new FormatException();
         }
     }
     return(base.ConvertFrom(context, culture, value));
 }
Exemple #2
0
        public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
        {
            object obj = base.ConvertTo(context, culture, value, destinationType);

            if (ConditionalAutoLengthConverter.IsSilverlightProject(context))
            {
                string str = value as string;
                if (str != null && ConditionalAutoLengthConverter.IsEquivalentToAuto(str))
                {
                    obj = "";
                }
            }
            return(obj);
        }