Frame.SetView(View, Boolean, Frame, Boolean) Method
Namespace: DevExpress.ExpressApp
Assembly: DevExpress.ExpressApp.v24.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.