/// <summary> /// When combined with a "Value" bind, controls when the view model is updated /// </summary> /// <typeparam name="TModel"></typeparam> /// <param name="this"></param> /// <param name="valueUpdate"></param> /// <returns></returns> public static DataBindBuilder <TModel> ValueUpdate <TModel>(this DataBindBuilder <TModel> @this, ValueUpdate valueUpdate) { @this.Builder.Attr("data-bind", "valueUpdate", string.Format("'{0}'", valueUpdate.ToString().ToLowerInvariant())); return(@this); }
public static DataBindBuilder <TModel> Click <TModel>(this DataBindBuilder <TModel> @this, string bindingProperty) { return(@this.Custom("click", bindingProperty)); }
/// <summary> /// Bind a radio button to a particular view model property /// <para> </para> /// <para>Usage Example:</para> /// <para> <input type="radio" @helper.DataBind(db => db.Checked(x => x.Gender, Gender.Male)) /></para> /// <para> </para> /// <para>Result:</para> /// <para> <input type="radio" value="Male" data-bind="checked: Gender" /></para> /// <para> </para> /// </summary> /// <typeparam name="TModel"></typeparam> /// <typeparam name="TValue"> </typeparam> /// <param name="this"></param> /// <param name="bindingProperty"></param> /// <param name="value"> </param> /// <returns></returns> public static DataBindBuilder <TModel> Checked <TModel, TValue>(this DataBindBuilder <TModel> @this, Expression <Func <TModel, TValue> > bindingProperty, object value) { @this.Builder.Attr("value", value.ToString()); return(@this.Custom("checked", bindingProperty)); }
/// <summary> /// Bind a checkbox to a *boolean* view model property /// <para> </para> /// <para>Usage Example:</para> /// <para> <input type="checkbox" @helper.DataBind(db => db.Checked(x => x.IsCool)) /></para> /// <para> </para> /// <para>Result:</para> /// <para> <input type="checkbox" data-bind="checked: IsCool" /></para> /// <para> </para> /// </summary> /// <typeparam name="TModel"></typeparam> /// <param name="this"></param> /// <param name="bindingProperty"></param> /// <returns></returns> public static DataBindBuilder <TModel> Checked <TModel>(this DataBindBuilder <TModel> @this, Expression <Func <TModel, bool> > bindingProperty) { return(@this.Custom("checked", bindingProperty)); }
public static DataBindBuilder <TModel> Visible <TModel>(this DataBindBuilder <TModel> @this, string bindingProperty) { return(@this.Custom("visible", bindingProperty)); }
public static DataBindBuilder <TModel> Visible <TModel>(this DataBindBuilder <TModel> @this, Expression <Func <TModel, bool> > bindingProperty) { return(@this.Custom("visible", bindingProperty)); }
public static DataBindBuilder <TModel> If <TModel, TValue>(this DataBindBuilder <TModel> @this, Expression <Func <TModel, TValue> > bindingProperty) { return(@this.Custom("if", bindingProperty)); }