Skip to main content
.NET 8.0+

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

ViewController.SetView(View) Method

Sets a specified View for a View Controller.

Namespace: DevExpress.ExpressApp

Assembly: DevExpress.ExpressApp.v24.2.dll

NuGet Package: DevExpress.ExpressApp

#Declaration

public void SetView(
    View newView
)

#Parameters

Name Type Description
newView View

A View object that represents a View to be set for the current View Controller.

#Remarks

View Controllers are used to perform specific actions with their View when they are activated (see Controller.Activated). This method sets the View specified by the View parameter to the current View Controller. Not any View can be set to a View Controller. If the specified View do not satisfy to the View Controller’s ViewController.TargetObjectType, ViewController.TargetViewId, ViewController.TargetViewNesting or ViewController.TargetViewType property, it is not assigned.

Generally, you do not need to use this method. When a Controller is registered within a Frame (see Frame.RegisterController), the Frame’s View is assigned automatically. You can override the ViewController.OnViewChanging method that is called before setting a View. For instance, you can prohibit activation of the current View Controller, if it is not intended for the View which is being set to it.

See Also