Wednesday, March 4, 2015
JFYI for creators of custom PropertyEditors for complex ListView in-place editing scenarios in WinForms
This is just a quick note for advanced XAFers creating complex PropertyEditors in WinForms.
If your custom PropertyEditor is intended for complex ListView in-place editing scenarios (e.g., drop-down editor data source filtering), then its underlying control should support the DevExpress.ExpressApp.Win.Core.IGridInplaceEdit interface.
The most common scenarios include data source filtering (e.g., the functionality of the DataSourceCriteria, DataSourceProperty and similar attributes) and obtaining information of the currently edited record in ListView for internal purposes (e.g., obtaining object type information). Standard XAF PropertyEditors whose underlying controls implement the IGridInplaceEdit interface include LookupPropertyEditor, ObjectPropertyEditor, PopupCriteriaPropertyEditor and ExpressionPropertyEditor. You can refer to their source code for more details. In addition, you can consider checking the How to work with referenced properties via a simple drop down list instead of the standard LookupPropertyEditor (Example) example source as well.
In our GridListEditor (well, and in NewItemRowDataSourcePropertyController too) we have special code that detects whether the underlying control supports the IGridInplaceEdit interface and automatically assigns the IGridInplaceEdit.GridEditingObject property in GridView events. If you use your PropertyEditor in other places (e.g., a vertical grid or tree list where you provided a custom inplace editing functionality), you can manually handle corresponding control events to set the IGridInplaceEdit.GridEditingObject property when an editor control is being shown. See the How to assign DataSourceProperty to a Cell in a TreeList ticket for an example.