Skip to main content
.NET Standard 2.0+

ViewController Class

Namespace: DevExpress.ExpressApp

Assembly: DevExpress.ExpressApp.v21.2.dll

Declaration

public class ViewController :
    Controller

Remarks

A ViewController class is a descendant of the Controller class. Use it as an ancestor for a custom Controller which is intended to function with a View. View Controllers are registered within both a Window and Frame. You can access the parent Frame using the Controller.Frame property, and its View using the ViewController.View property. The Object Space used by the current View can be accessed via the protected ObjectSpace property. To implement custom code to be performed at runtime, use the Controller’s mechanisms for activation and deactivation, i.e., handle the Controller.Activated and Controller.Deactivated events.

You can specify the Views for which a View Controller will be activated. For this purpose, use the ViewController.TargetObjectType, ViewController.TargetViewId, ViewController.TargetViewNesting and ViewController.TargetViewType properties (see How do I specify in which View (form) a Controller should be activated). You can also prohibit Controller activation for a particular View by overriding the ViewController.OnViewChanging method.

Note

CodeRush allows you to add Actions and Controllers with a few keystrokes. To learn about the Code Templates for XAF, refer to the following help topic: XAF Templates.

If you need to implement features with Windows (e.g., customize a Window’s Template or View), use the WindowController class instead of ViewController.

The following code snippets (auto-collected from DevExpress Examples) contain references to the ViewController class.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

Implements

See Also