ObjectViewController<ViewType, ObjectType> Class
A base class for View Controllers intended for Object Views.
Namespace: DevExpress.ExpressApp
Assembly: DevExpress.ExpressApp.v18.1.dll
Declaration
public abstract class ObjectViewController<ViewType, ObjectType> :
ViewController<ViewType>
where ViewType : ObjectView
Type Parameters
Name |
---|
ViewType |
ObjectType |
Remarks
This Controller is derived from the ObjectViewController and introduces two generic type parameters. The ViewType parameter specifies the ViewController.TargetViewType value. The ObjectType specifies the ViewController.TargetObjectType value. You can use this class as the base class for a custom Controller to ensure that the custom Controller is activated for a specific View type and object type.
The following code snippet demonstrates a custom View Controller derived from the generic ObjectViewController.
public class ContactController : ObjectViewController<ListView, Contact> {
protected override void OnViewControlsCreated() {
base.OnViewControlsCreated();
// The View property is of the ListView type
ASPxGridListEditor listEditor = View.Editor as ASPxGridListEditor;
if (listEditor != null) {
// Perform some actions here
// ...
}
}
}
Note that Visual Studio designer cannot be used with generic components, so you cannot use it to design generic Controllers. As a possible workaround, you can declare an intermediate non-generic base class, derived from a generic Controller and decorated with the DesignerCategoryAttribute, and then derive your custom Controller from this intermediate class. The following code snippet illustrates this.
[System.ComponentModel.DesignerCategory("Component")]
public class MyIntermediateListViewController : ObjectViewController<ListView, Contact> { }
public class MyViewController : MyIntermediateListViewController {
//...
}