Current filter:
                                You should refresh the page.
                                Support Center
                                  • With XAF v16.2.4, you can apply Application Model changes to a View without recreating it. To do this, save the Frame's View to a variable and then unlink it from the Frame by passing null to the SetView method. After that, make the required changes to the model, call the LoadModel method with the false parameter and then set the saved View back to the Frame using the SetView method. Here is the generic code illustrating this pattern:

                                    View view = Frame.View;
                                    if(Frame.SetView(null, true, null, false)) {
                                        // Make required changes with the model here. 
                                        // ... 


                                    Below is also a full ViewController code for accomplishing the two most popular WinForms scenarios benefiting from this capability:

                                    using System; using DevExpress.ExpressApp; using DevExpress.ExpressApp.Actions; using DevExpress.ExpressApp.Scheduler.Win; using DevExpress.ExpressApp.Win.Editors; using DevExpress.Persistent.Base; using DevExpress.Persistent.Base.General; namespace MainDemo.Module.Win.Controllers {     public class RefreshViewControlsAfterModelChangesViewController : ObjectViewController<ListView, IEvent> {         public RefreshViewControlsAfterModelChangesViewController() {             new SimpleAction(this, "SwitchMasterDetailMode", PredefinedCategory.View.ToString(), (s, e) => {                 //Save the current View and extract it from the Frame.                 var savedView = View;                 if(Frame.SetView(null, true, null, false)) {                     // Make required changes to the related Application Model nodes here.                     MasterDetailMode defaultMasterDetailMode = MasterDetailMode.ListViewOnly;                     savedView.Model.MasterDetailMode = savedView.Model.MasterDetailMode == defaultMasterDetailMode ? MasterDetailMode.ListViewAndDetailView : defaultMasterDetailMode;                     // Update the saved View according to the latest model changes and assign it to the current Frame.                     savedView.LoadModel(false);                     Frame.SetView(savedView);                     //Optionally update the current object of the inner DetailView.                     if(savedView.EditView != null) {                         savedView.EditView.CurrentObject = savedView.CurrentObject;                     }                 }             });             new SimpleAction(this, "SwitchEditor", PredefinedCategory.View.ToString(), (s, e) => {                 var savedView = View;                 if(Frame.SetView(null, true, null, false)) {                     Type defaultListEditorType = Application.Model.Views.DefaultListEditor;//typeof(GridListEditor)                     savedView.Model.EditorType = savedView.Model.EditorType == defaultListEditorType ? typeof(SchedulerListEditor) : defaultListEditorType;                     savedView.LoadModel(false);                     Frame.SetView(savedView);                 }             });         }     } }

                                    The attached HowItWorksInAction.swf video illustrates the results in the application UI. 

                                    See also: 
                                    Core - Provide a platform-independent solution for reloading View settings after customizing its Application Model information

                                0 Solutions

                                Creation Date Rating Importance Sort by

                                If you need additional product information, write to us at or call us at +1 (818) 844-3383

                                FOLLOW US

                                DevExpress engineers feature-complete Presentation Controls, IDE Productivity Tools, Business Application Frameworks, and Reporting Systems for Visual Studio, along with high-performance HTML JS Mobile Frameworks for developers targeting iOS, Android and Windows Phone. Whether using WPF, ASP.NET, WinForms, HTML5 or Windows 10, DevExpress tools help you build and deliver your best in the shortest time possible.

                                Copyright © 1998-2017 Developer Express Inc.
                                All trademarks or registered trademarks are property of their respective owners