IComplexViewItem Interface
Declares members implemented by View Items that have access to the XafApplication object and IObjectSpace of the current View.
Namespace: DevExpress.ExpressApp.Editors
Assembly: DevExpress.ExpressApp.v24.1.dll
NuGet Package: DevExpress.ExpressApp
Declaration
Remarks
When implementing a custom Property Editor or a custom View Item you may want to:
- load arbitrary data from the application database;
- use methods provided by the application object, (e.g., XafApplication.CreateDetailView).
In these scenarios, a View Item or Property Editor requires access to the application object and to the Object Space of the current View. To get these objects, the Property Editor should support the IComplexViewItem interface. This interface exposes a single IComplexViewItem.Setup method that accepts objectSpace and application parameters. This method is called automatically for all IComplexViewItem View Items when a View is shown.
Here is an example of how to implement IComplexViewItem in a PropertyEditor descendant:
using DevExpress.ExpressApp;
using DevExpress.ExpressApp.Editors;
// ...
public class CustomPropertyEditor : PropertyEditor, IComplexViewItem {
private IObjectSpace objectSpace;
private XafApplication application;
#region IComplexViewItem Members
void IComplexViewItem.Setup(IObjectSpace objectSpace,
XafApplication application) {
this.objectSpace = objectSpace;
this.application = application;
}
#endregion
// Example:
protected override object CreateControlCore() {
IList dataSource = objectSpace.GetObjects(Model.ModelMember.Type);
// ...
}
}