private static IFrameTemplate GetModelEditorDetailViewForm(XafApplication xafApplication)
 {
     if (((WinApplication)xafApplication).UseOldTemplates || ((IModelOptionsWin)xafApplication.Model.Options).FormStyle != RibbonFormStyle.Ribbon)
     {
         var template = new ModelEditorDetailViewForm();
         var supportClassicToRibbonTransform = (ISupportClassicToRibbonTransform)template;
         if (xafApplication.Model?.Options is IModelOptionsWin optionsWin)
         {
             supportClassicToRibbonTransform.FormStyle = optionsWin.FormStyle;
         }
         return(template);
     }
     return(new ModelEditorDetailRibbonFormV2());
 }
Exemplo n.º 2
0
        void CreateCustomTemplate(object sender, CreateCustomTemplateEventArgs e)
        {
            var xafApplication = (XafApplication)sender;

            xafApplication.CreateCustomTemplate -= CreateCustomTemplate;
            var template = new ModelEditorDetailViewForm {
                Application = () => Application
            };
            var supportClassicToRibbonTransform = template as ISupportClassicToRibbonTransform;

            if (xafApplication.Model != null && xafApplication.Model.Options is IModelOptionsWin)
            {
                supportClassicToRibbonTransform.FormStyle = ((IModelOptionsWin)xafApplication.Model.Options).FormStyle;
            }

            e.Template = template;
        }