예제 #1
0
        public object ConvertValue(object value)
        {
            object convertedValue = value;

            var memberType = TargetProperty.GetMemberType();

            if (Binding.Converter != null)
            {
//				try
                {
                    object parameter = Element;
                    if (Binding.ConverterParameter != null)
                    {
                        parameter = Binding.ConverterParameter;
                    }

                    convertedValue = Binding.Converter.Convert(value, memberType, parameter, CultureInfo.CurrentUICulture);
                }
//				catch (InvalidCastException) {}
//				catch (NotSupportedException) {}
//				catch (NotImplementedException) {}
            }

            var typeCode = Convert.GetTypeCode(convertedValue);

            if (typeCode != TypeCode.Object && typeCode != TypeCode.Empty)
            {
                convertedValue = Convert.ChangeType(convertedValue, memberType);
            }

            return(convertedValue);
        }