Example #1
0
        // Exceptions:
        //   System.ArgumentNullException:
        //     The source object is a null reference (Nothing in Visual Basic).
        //
        //   System.ArgumentException:
        //     The example object is not a null reference and is not a valid type that can
        //     be converted to a System.Windows.Thickness.
        /// <summary>
        /// Attempts to create an instance of System.Windows.Thickness from a specified
        /// object.
        /// </summary>
        /// <param name="context">The context information for a type.</param>
        /// <param name="culture">The System.Globalization.CultureInfo of the type being converted.</param>
        /// <param name="value">The sourceSystem.Object being converted.</param>
        /// <returns>An instance of System.Windows.Thickness created from the converted source.</returns>
        public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
        {
            if (value == null)
            {
                throw GetConvertFromException(value);
            }

            if (value is string)
            {
                return(Thickness.INTERNAL_ConvertFromString((string)value));
            }

            return(base.ConvertFrom(context, culture, value));
        }