Current filter:
                                You should refresh the page.
                                  • Steps to Reproduce:

                                    1. Use the MainDemo solution;
                                    2. Put the following class into the MainDemo.Module.Win:
                                    using System;
                                    using DevExpress.ExpressApp;
                                    using DevExpress.Persistent.Base;
                                    using DevExpress.ExpressApp.Model;
                                    using DevExpress.ExpressApp.Actions;
                                    using DevExpress.ExpressApp.Model.Core;
                                    using DevExpress.ExpressApp.ViewVariantsModule;
                                    namespace MainDemo.Module.Win {
                                        public class ViewController1 : ViewController {
                                            private SimpleAction saSaveView;
                                            public ViewController1() {
                                                saSaveView = new SimpleAction(this, "SaveView", PredefinedCategory.View);
                                                saSaveView.Caption = "Save View";
                                                saSaveView.Execute += saSaveView_Execute;
                                            private void saSaveView_Execute(object sender, SimpleActionExecuteEventArgs e) {
                                                ChangeVariantMainWindowController variantMainWindowController = Frame.GetController<ChangeVariantMainWindowController>();
                                                VariantsInfo info = variantMainWindowController.GetVariants(View);
                                                string id = String.Format("{0}_{1}", info.RootViewId, Guid.NewGuid());
                                                IModelViews modelViews = View.Model.Application.Views;
                                                ModelNode copy = (modelViews as ModelNode).CloneNodeFrom((ModelNode)View.Model, id);
                                                ChangeVariantController variantViewController = Frame.GetController<ChangeVariantController>();
                                                IModelViewVariants variants = modelViews[info.RootViewId] as IModelViewVariants;
                                                if (variants != null) {
                                                    IModelVariant variant = variants.Variants.AddNode<IModelVariant>(id);
                                                    variant.View = copy as IModelView;
                                                    variant.Caption = id;
                                    3. Run the MainDemo.Win application and execute the "Save View" action and see that a new variant was added;
                                    4. Set the newly added variant as the current one and see that the default View settings were applied.
                                    Actual Results:
                                    If you set a breakpoint in the ModelNode copy = (modelViews as ModelNode).CloneNodeFrom((ModelNode)View.Model, id); line and inspect the settings of the "View.Mode" and "copy" models, then you will see that they are different.
                                    Actually, the "copy" represents a copy of the default layer of the View.Mode" node.

                                0 Solutions

                                Creation Date Importance Sort by