Beispiel #1
0
        static HtmlBinding()
        {
            Providers         = new HtmlBindingContextProviderCollection();
            ExpressionBinders = new ExpressionBinderCollection();
            ElementBinders    = new List <IHtmlBinder>();

            Providers.Add(new HtmlListBindingContextProvider());



            StyleBinder   = new StyleBinder();
            ScriptBinder  = new ScriptBinder();
            LiteralBinder = new LiteralBinder();



            EvalExpressionBinder     = new EvalExpressionBinder();
            EvalListExpressionBinder = new EvalListExpressionBinder();



            ElementBinders.Add(StyleBinder);
            ElementBinders.Add(ScriptBinder);
            ElementBinders.Add(LiteralBinder);

            ExpressionBinders.Add(EvalExpressionBinder);
            ExpressionBinders.Add(EvalListExpressionBinder);
        }
Beispiel #2
0
        private HtmlBindingContext(IHtmlBinder[] htmlBinders, IExpressionBinder[] expressionBinders, IHtmlContainer scope, object dataModel)
        {
            if (htmlBinders == null)
            {
                throw new ArgumentNullException("binders");
            }

            if (scope == null)
            {
                throw new ArgumentNullException("scope");
            }

            Binders      = htmlBinders;
            BindingScope = scope;
            DataModel    = dataModel;

            _expressionBinders = new ExpressionBinderCollection(expressionBinders);
        }
Beispiel #3
0
        /// <summary>
        /// 创建 HtmlBindingContext 实例
        /// </summary>
        /// <param name="scope">要进行数据绑定的范畴</param>
        /// <param name="bindingContext">父级数据绑定上下文</param>
        /// <param name="dataModel">数据模型,若不提供则使用当前的数据模型</param>
        protected HtmlBindingContext(HtmlBindingContext bindingContext, IHtmlContainer scope, object dataModel = null)
        {
            if (bindingContext == null)
            {
                throw new ArgumentNullException("bindingContext");
            }

            if (scope == null)
            {
                throw new ArgumentNullException("scope");
            }

            ParentContext = bindingContext;
            BindingScope  = scope;
            DataModel     = dataModel ?? bindingContext.DataModel;

            Binders            = bindingContext.Binders;
            _expressionBinders = new ExpressionBinderCollection(bindingContext._expressionBinders);
        }