Beispiel #1
0
        private object _ProvideValue(object target, string propertyName)
        {
            var path      = ValueConverterUtil.GetPath(this.Expression, true);
            var converter = ValueConverterUtil.GetConverter(this.Expression, target, propertyName);
            var parameter = ValueConverterUtil.GetParameter(this.Expression, target, propertyName);

            return(new TemplateBindingExpression(path, converter, parameter));
        }
        private object _ProvideValue(object target, string propertyName)
        {
            var path      = ValueConverterUtil.GetPath(this.Expression, false);
            var converter = ValueConverterUtil.GetConverter(this.Expression, target, propertyName);
            var parameter = ValueConverterUtil.GetParameter(this.Expression, target, propertyName);

            if (this.Expression.IndexOf("ElementName") > -1)
            {
                throw new XamlException("绑定表达式暂不支持ElementName语法");
            }
            else if (this.Expression.IndexOf("Source") > -1)
            {
                throw new XamlException("绑定表达式暂不支持Source语法");
            }
            else
            {
                //基于数据上下文的绑定表达式
                return(new DataContextBindingExpression(path, converter, parameter));
            }
        }