Ticket T358750
Visible to All Users
Duplicate

We have closed this ticket because another page addresses its subject:

How to change font settings for all XAF UI elements (toolbar and context menus, property editors, etc.)

How to globally change font size of all UI controls (editors, toolbar and context menus, etc.)

created 9 years ago (modified 9 years ago)

Hi,

as stated in A2761 it's possible to change the default font of most controls in a XafApplication. However it will not change the font of the Menus (toolbar, contextmenu, …).

As for the toolbars, I tried the solution stated in B203481,  updating the template whenever a frame is assigned. This will not change the font of the contextmenu. This seems possible via the DefaultMenuFont property.
However this property seems only to be evaluated on startup and even before a user has logged in. Currently I extended the model with an AppFontSize property, which can be set via the toolbar and is directly stored in the user differences.

Any advice how I can set the DefaultMenuFont so it's considered and a user has logged in? Or is there another possibility I can change the contextmenu font size to the user preferences?

Thanks in advance
Daniel

Show previous comments (1)
Dennis Garavsky (DevExpress) 9 years ago

    >>Any advice how I can set the DefaultMenuFont so it's considered and a user has logged in?
    You can set user-specific options in the DevExpress.ExpressApp > XafApplication > LoggedOn or DevExpress.ExpressApp > XafApplication > UserDifferencesLoaded event handlers.

    DF DF
    Daniel Fischer 1 9 years ago

      Hi Dennis,

      thanks for the response!

      As for the main views and the toolbar, setting the font size at UserDifferencesLoaded works nicely. However the context menus are still at their default font.

      Maybe the WinForms team has a proper solution on that topic.
      Greetings

      Sasha (DevExpress Support) 9 years ago

        Hello Daniel,
        I tested this behavior and see that the font of bars and context menus is not changed when the DefaultMenuFont property is set after the form is initialized.
        We need additional time to research this behavior. We will update this thread as soon as we have any results.
        Please watch for our updates.

        Answers approved by DevExpress Support

        created 9 years ago (modified 9 years ago)

        Hello Daniel,

        I used the following Controller and it worked fine for me with v15.1 and v15.2 (new WinForms templates are required):

        C#
        namespace MainDemo.Module.Win { using System; using System.Drawing; using DevExpress.XtraBars; using DevExpress.ExpressApp; using DevExpress.ExpressApp.Win.Controls; public class T358750_Standard_Toolbar : WindowController { protected override void OnActivated() { base.OnActivated(); Window.TemplateChanged += Window_TemplateChanged; } private void Window_TemplateChanged(object sender, EventArgs e) { if(Frame.Template is IBarManagerHolder) { BarManager manager = ((IBarManagerHolder)Frame.Template).BarManager; if(manager.Controller == null) { manager.Controller = new BarAndDockingController(); } var controller = manager.Controller; controller.AppearancesBar.MainMenu.Font = new Font("Arial", 16); controller.AppearancesBar.ItemsFont = new Font("Arial", 16); } } protected override void OnDeactivated() { Window.TemplateChanged -= Window_TemplateChanged; base.OnDeactivated(); } } }

        Would you please check how this works for you? If this does not work as expected, please attach your debuggable sample along with the screenshots demonstrating the expected results. Thanks.

          Show previous comments (4)
          DF DF
          Daniel Fischer 1 9 years ago

            Thank you Dennis!
            This works as expected. I marked your first controller as the answer.
            For every other user experiencing this problem:
            You need to change the code as suggested in the post above. (I don't know how I can mark this post as second answer)

            Dennis Garavsky (DevExpress) 9 years ago

              I am happy to hear of your results, Daniel. It is fine to leave my second comment as is, because it is specific to your custom project code only.

              Dennis Garavsky (DevExpress) 9 years ago

                Daniel,

                Just a final note: at the moment (15.2.7), you cannot use the DevExpress.XtraEditors.WindowsFormsSettings.DefaultMenuFont property, because BarAndDockingController settings are cached and not reset by default.
                I have discussed this with the leaders of our WinForms division, and this behavior may be changed in the future versions of our WinForms Suite, so that only a single DefaultMenuFont property adjustment is required.

                Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

                Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.