/// <summary>
 /// Creates a new style value expression for the style key with the expression and an optional convertor and base value
 /// </summary>
 /// <param name="key">The style key this expression is assigned for</param>
 /// <param name="expressionString">The exppresion to be evaluated at runtime</param>
 /// <param name="convertor">An otpional convertor to make the result the required type</param>
 /// <param name="baseValue">An optional base value that will be returned before the expression is bound</param>
 public StyleValueExpression(PDFStyleKey <T> key, string expressionString, StyleValueConvertor <T> convertor, T baseValue)
     : base(key, baseValue)
 {
     this._expressionString = expressionString ?? throw new ArgumentNullException(nameof(expressionString));
     this._convertor        = convertor;
     this._variableProvider = null;
     this._expression       = null;
 }
Ejemplo n.º 2
0
        protected bool AttachExpressionBindingHandler <AttrT>(Style style, PDFStyleKey <AttrT> key, string value, StyleValueConvertor <AttrT> convert)
        {
            StyleValueExpression <AttrT> expression = new StyleValueExpression <AttrT>(key, value, convert);

            style.DataBinding += expression.BindValue;

            if (style.IsValueDefined(key))
            {
                style.RemoveValue(key);
            }

            style.AddValue(expression);
            return(true);
        }
        //
        // .ctor
        //

        #region public StyleValueExpression(PDFStyleKey<T> key, string expressionString, StyleValueConvertor<T> convertor)

        /// <summary>
        /// Creates a new style value expression for the style key with the expression and an optional convertor
        /// </summary>
        /// <param name="key">The style key this expression is assigned for</param>
        /// <param name="expressionString">The exppresion to be evaluated at runtime</param>
        /// <param name="convertor">An otpional convertor to make the result the required type</param>
        public StyleValueExpression(PDFStyleKey <T> key, string expressionString, StyleValueConvertor <T> convertor)
            : this(key, expressionString, convertor, default)
        {
        }