/// <summary> /// Converts the given object to the type of this converter, using the specified context and culture information. /// </summary> /// <param name="context">A System.ComponentModel.ITypeDescriptorContext that provides a format context.</param> /// <param name="culture">The System.Globalization.CultureInfo to use as the current culture.</param> /// <param name="value">The System.Object to convert.</param> /// <returns> /// An <see cref="ActiveCommandCollection"/> that represents the converted value. /// </returns> /// <remarks> /// <para>This method will convert a string with format "<commandname>, ..." where <commandname> is the name of one of the supported commands.</para> /// </remarks> /// <example> /// <code> /// "OK, Cancel, Yes, No" /// </code> /// </example> public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) { if (value is string AsString) { string[] StringList = AsString.Split(','); ActiveCommandCollection Result = new ActiveCommandCollection(); foreach (string Name in StringList) { ActiveCommandTypeConverter.TryParseName(Name.Trim(), (ActiveCommand command) => Result.Add(command)); } return(Result); } return(base.ConvertFrom(context, culture, value)); }