// ReSharper restore MemberCanBePrivate.Global

        public EditPanelField(Expression <Func <TModel, TValue> > expression, EditPanelFieldSize size = EditPanelFieldSize.Default, Func <dynamic, object> editorFormat = null, string header = null, bool foreverAlone = false)
        {
            this.Format     = editorFormat;
            this.Expression = expression;
            this.Header     = header;
            this.WholeRow   = foreverAlone;
            this.Size       = size;
        }
示例#2
0
 /// <summary>
 /// Adds a field to the edit panel.
 /// </summary>
 /// <typeparam name="TValue">Type of value returned from the model property to add to the edit panel.</typeparam>
 /// <param name="expression">Expression that represents the property of the model to be added to the edit panel.</param>
 /// <param name="size"></param>
 /// <param name="editorFormat"></param>
 /// <param name="formatDescription"></param>
 /// <param name="header"></param>
 /// <param name="wholeRow"></param>
 public void AddField <TValue>(
     Expression <Func <TModel, TValue> > expression,
     EditPanelFieldSize size             = EditPanelFieldSize.Default,
     Func <dynamic, object> editorFormat = null,
     string header = null,
     bool wholeRow = false)
 {
     this.Fields.Add(
         new EditPanelField <TModel, TValue>(expression, size, editorFormat, header, wholeRow));
 }
示例#3
0
        /// <summary>
        /// Adds a field to the edit panel, passing a method to render the editor.
        /// </summary>
        /// <typeparam name="TValue">Type of value returned from the model property to add to the edit panel.</typeparam>
        /// <param name="expression">Expression that represents the property of the model to be added to the edit panel.</param>
        /// <param name="expressionFormat">Delegate that renders the editor for the property represented by the expression.</param>
        /// <param name="size">[optional] Size of the editor.</param>
        public void AddField <TValue>(
            Expression <Func <TModel, TValue> > expression,
            Func <Expression <Func <TModel, TValue> >, object> expressionFormat,
            EditPanelFieldSize size = EditPanelFieldSize.Default)
        {
            if (expressionFormat == null)
            {
                throw new ArgumentNullException("expressionFormat");
            }

            var format = (Func <dynamic, object>)(d => expressionFormat(expression));

            this.Fields.Add(new EditPanelField <TModel, TValue>(expression, size, format));
        }