예제 #1
0
        protected override object MakeCompatible(object instance, ConversionRequest conversionRequest, BuildContext buildContext)
        {
            var    me         = conversionRequest.Value as IMarkupExtension;
            object finalValue = conversionRequest.Value;

            if (me != null)
            {
                var value = me.GetValue(contextFactory.CreateExtensionContext(new Assignment(new KeyedInstance(instance), conversionRequest.Member, conversionRequest.Value), buildContext));
                finalValue = value;
            }

            return(base.MakeCompatible(instance, new ConversionRequest(conversionRequest.Member, finalValue), buildContext));
        }
예제 #2
0
        protected virtual object MakeCompatible(object instance, ConversionRequest conversionRequest, BuildContext buildContext)
        {
            var value = conversionRequest.Value;

            if (value is string)
            {
                var valueContext    = contextFactory.CreateConverterContext(conversionRequest.Member.MemberType, value, buildContext);
                var compatibleValue = sourceValueConverter.GetCompatibleValue(valueContext);
                return(compatibleValue);
            }

            return(value);
        }