Пример #1
0
        // Exceptions:
        //   System.NotSupportedException:
        //     value is null or is not a valid type for conversion.
        /// <summary>
        /// Attempts to convert a specified object to an instance of System.Windows.FontWeight.
        /// </summary>
        /// <param name="context">Context information of a type.</param>
        /// <param name="culture">System.Globalization.CultureInfo of the type being converted.</param>
        /// <param name="value">The object being converted.</param>
        /// <returns>The instance of System.Windows.FontWeight created from the converted value.</returns>
        public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
        {
            if (value == null)
            {
                throw GetConvertFromException(value);
            }

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

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