System.Windows.Interactivity.TriggerActionTypeConverter.ConvertFrom C# (CSharp) Method

ConvertFrom() public method

public ConvertFrom ( ITypeDescriptorContext context, CultureInfo culture, object value ) : object
context ITypeDescriptorContext
culture System.Globalization.CultureInfo
value object
return object
        public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
        {
            string s = value as string;
            if (String.IsNullOrEmpty(s) == false) {
                ScriptTriggerAction scriptAction = ScriptTriggerAction.Parse(s);
                if (scriptAction == null) {
                    throw new InvalidOperationException("Unable to parse the script expression '" + s + "' as a valid script action.");
                }

                return scriptAction;
            }

            return null;
        }