public static IScreenToElementBinder <TObject, TPropertyType> Bind <TObject, TPropertyType>( this ScreenBinder <TObject> screenBinder, Expression <Func <TObject, TPropertyType> > propertyToBindTo) { var propertyInformation = new ExpressionInspectorFactory().Create <TObject>().PropertyFor(propertyToBindTo); return(new ScreenToElementBinder <TObject, TPropertyType>(screenBinder, propertyInformation)); }
/// <summary> /// Binds the property to the grid using the dev express data binding features. /// (i.e. Value will be set automtically into bound objects). /// Error notification if available however, if the source implements the IValidatable interface /// or the IDxErrorInfo /// </summary> public static IGridViewAutoBindColumn <TypeToBindTo, PropertyType> AutoBind <TypeToBindTo, PropertyType> (this GridViewBinder <TypeToBindTo> gridViewBinder, Expression <Func <TypeToBindTo, PropertyType> > propertyToBindTo) { //Resolve property info for the given expression var propertyInfo = new ExpressionInspectorFactory().Create <TypeToBindTo>().PropertyFor(propertyToBindTo); //Create a column binder and add it to the gridview binder var columnBinder = new GridViewAutoBindColumn <TypeToBindTo, PropertyType>(gridViewBinder, propertyInfo); gridViewBinder.AddColumn(columnBinder); return(columnBinder); }