Frame.SetView(View, Boolean, Frame, Boolean) Method
Namespace: DevExpress.ExpressApp
Assembly: DevExpress.ExpressApp.v22.2.dll
NuGet Package: DevExpress.ExpressApp
Declaration
Parameters
Name | Type | Description |
---|---|---|
view | View | |
updateControllers | Boolean | true, if the Frame’s Controllers are activated after setting a new View; otherwise, false. |
sourceFrame | Frame | A Frame object in which creating a new View was requested. |
disposeOldView | Boolean | true, if the Frame’s old View should be disposed; otherwise, false. |
Returns
Type | Description |
---|---|
Boolean | true, if an old View can be changed by another one; otherwise, false. |
Remarks
This overload of the SetView method allows you to apply Application Model changes to a View without recreating it. Save the Frame’s View to a variable, then set the Frame’s View to null. Make the required changes to the model and then set the saved View back to the Frame.
View view = Frame.View;
if(Frame.SetView(null, true, null, false)) {
// Make required changes with the model here.
// ...
view.LoadModel(false);
Frame.SetView(view);
}
It is recommended to pass false to the View.LoadModel method to avoid creating controls within this method. Otherwise, the OnViewControlCreated methods of View’s Controllers will not be called.
The complete example of a Controller that uses the SetView method is provided in the How to: Apply Application Model Changes to the Current View Immediately topic.
Related GitHub Examples
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the SetView(View, Boolean, Frame, Boolean) 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.