Skip to main content
A newer version of this page is available. .

Frame.GetController<ControllerType>() Method

Returns a specified Controller from the current Frame‘s Frame.Controllers collection.

Namespace: DevExpress.ExpressApp

Assembly: DevExpress.ExpressApp.v18.2.dll

Declaration

public ControllerType GetController<ControllerType>()
    where ControllerType : Controller

Type Parameters

Name
ControllerType

Returns

Type Description
ControllerType

A specified Controller found in the current Frame‘s Frame.Controllers collection.

Remarks

Use the GetController<ControllerType> method to access a particular Controller from the current Frame‘s Frame.Controllers collection. The ControllerType generic type argument specifies the required Controller type. In this argument, you can specify any class which is a descendant of the Controller class.

If there is no Controller of the specified type in the Frame.Controllers collection, this method returns the first Controller which is assignable to this type.

Important

To avoid possible null reference exceptions when accessing an existing Controller from your code, always ensure that the Frame.GetController<ControllerType> method result is not null when the XafApplication.OptimizedControllersCreation property is true.

The following code snippets (auto-collected from DevExpress Examples) contain references to the GetController<ControllerType>() method.

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.

See Also