Ejemplo n.º 1
0
        protected override object ProvideExpression(IServiceProvider provider, BindableObject obj, PropertyInfo property)
        {
            if (provider == null)
            {
                throw new ArgumentNullException(nameof(provider));
            }
            if (property == null)
            {
                throw new ArgumentNullException(nameof(property));
            }

            var expression = new GetExpression {
                Source       = Source,
                Path         = Path,
                Format       = Format != null && Format.IndexOf('{') < 0 ? "{0:" + Format + "}" : Format,
                Converter    = Converter,
                Culture      = Culture,
                Parameter    = Parameter,
                TargetObject = obj,
                TargetType   = property.PropertyType,
            };

            obj?.Bind(property, expression);
            return(expression.GetValue());
        }
Ejemplo n.º 2
0
        protected override object ProvideExpression (IServiceProvider provider, BindableObject obj, [NotNull] PropertyInfo prop)
        {
            if (prop == null)
                throw new ArgumentNullException(nameof(prop));

            var expression = new GetExpression {
                Source = Source,
                Path = Path,
                Format = Format != null && Format.IndexOf('{') < 0 ? "{0:" + Format + "}" : Format,
                Converter = Converter,
                Culture = Culture,
                Parameter = Parameter,
                TargetObject = obj,
                TargetType = prop.PropertyType,
            };
            obj?.Bind(prop, expression);
            return expression.GetValue();
        }