Current filter:
                                You should refresh the page.
                                We apologize for the inconvenience. Our ordering system and the support center may be offline for a few hours on Sunday, May 19 due to maintenance tasks.
                                0
                                  • I currently use a Ribbon module in my XAF application. How do I customize the Ribbon forms used by XAF?

                                You must  log in  or  register  to leave comments

                                1 Solution

                                0

                                ==================================

                                This KB article is now obsolete. Refer to the Templates Customization help topic for a solution.

                                ==================================


                                To accomplish this, use the following approach:
                                1. add the RibbonUIWindowsFormsModule from the Toolbox to your Windows Forms application project:

                                2. include a ribbon form into your Windows Forms application project (you need to copy it from the ...\Sources\FrameTemplates\XX\Ribbon folder):

                                3. change the form's name space to the DevExpress.ExpressApp.RibbonUI.Win.CustomTemplates to make sure that this is a custom form;

                                4. customize this form as required;

                                5. create a descendant of the RibbonFrameTemplateFactory class:


                                	
                                [C#]
                                using DevExpress.ExpressApp.RibbonUI.Win; using DevExpress.ExpressApp.RibbonUI.Win.Templates; using DevExpress.ExpressApp; using DevExpress.ExpressApp.Win; namespace WinSolution.Win { public class MyRibbonFrameTemplateFactory : RibbonFrameTemplateFactory { public MyRibbonFrameTemplateFactory(WinApplication application) : base(application) { } protected override DevExpress.ExpressApp.Templates.IFrameTemplate CreateApplicationWindowTemplate() { return new RibbonMainForm(GetTemplateInfo(TemplateContext.ApplicationWindow)); } protected override DevExpress.ExpressApp.Templates.IFrameTemplate CreateViewTemplate() { return new RibbonDetailViewForm(GetTemplateInfo(TemplateContext.View)); } } } Imports DevExpress.ExpressApp.RibbonUI.Win Imports DevExpress.ExpressApp.RibbonUI.Win.Templates Imports DevExpress.ExpressApp Imports DevExpress.ExpressApp.Win Namespace WinSolution.Win Public Class MyRibbonFrameTemplateFactory Inherits RibbonFrameTemplateFactory Public Sub New(ByVal application As WinApplication) MyBase.New(application) End Sub Protected Overrides Function CreateApplicationWindowTemplate() As DevExpress.ExpressApp.Templates.IFrameTemplate Return New RibbonMainForm(GetTemplateInfo(TemplateContext.ApplicationWindow)) End Function Protected Overrides Function CreateViewTemplate() As DevExpress.ExpressApp.Templates.IFrameTemplate Return New RibbonDetailViewForm(GetTemplateInfo(TemplateContext.View)) End Function End Class End Namespace

                                6. add the following line in the Main method:


                                	
                                [C#]
                                //... application.FrameTemplateFactory = new MyRibbonFrameTemplateFactory(application); //... '... application.FrameTemplateFactory = New MyRibbonFrameTemplateFactory(application) '...

                                7. Finally, make sure that compilation is successful and then run the application. I have attached a complete sample project which shows this approach. See Also:
                                E80003
                                How to: Customize a Template

                                You must  log in  or  register  to leave comments