Esempio n. 1
0
        public static string GetRoute(LambdaExpression expression)
        {
            RouteVisitor v = new RouteVisitor();

            v.Visit(expression.Body);
            return(v.sb.ToString());
        }
Esempio n. 2
0
 public static T Bind <T, S>(this T bindable, DependencyProperty property, S source, Expression <Func <S, object> > sourcePath, IValueConverter converter) where T : DependencyObject
 {
     BindingOperations.SetBinding(bindable, property, new Binding(RouteVisitor.GetRoute(sourcePath))
     {
         Source = source, Converter = converter
     });
     return(bindable);
 }
Esempio n. 3
0
        static ConstantExpression GetPathConstant(Expression expression)
        {
            if (expression.NodeType == ExpressionType.Quote)
            {
                expression = ((UnaryExpression)expression).Operand;
            }

            if (expression.NodeType != ExpressionType.Lambda)
            {
                throw new InvalidOperationException();
            }

            string str = RouteVisitor.GetRoute((LambdaExpression)expression);

            return(Expression.Constant(str));
        }
Esempio n. 4
0
 public static T Bind <T, S>(this T bindable, DependencyProperty property, Expression <Func <S, object> > sourcePath) where T : DependencyObject
 {
     BindingOperations.SetBinding(bindable, property, new Binding(RouteVisitor.GetRoute(sourcePath)));
     return(bindable);
 }