Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8652227
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T14:15:36+00:00 2026-06-12T14:15:36+00:00

I am developng a WPF application which will be used on a couple of

  • 0

I am developng a WPF application which will be used on a couple of different PC types. The first type is more of a development machine with dual hi-res monitors; the second is a hand-held touch screen about 800×600.

Using the MVVM pattern, I have developed some different Views which display more or less information depending on the chosen mode. In general, the layout scales well enough.

I also have some dialog boxes but at the moment these are optimised for the hi-res mode. Unfortunately the buttons appear very small on the touch screen and are difficult to hit reliably.

I was wondering how to restyle the dialogs dynamically. I would like to have one application setting which sets the screen type and thereby control styles. So for example, if the screen is a touch screen then all buttons and menus will have a larger default size.

Are Themes the way to go? If so, can someone point me at a good tutorial? (not just using existing themes but also creating them)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T14:15:38+00:00Added an answer on June 12, 2026 at 2:15 pm

    In the interest of changing styles, I do the following:

    1. Create a style sheet for each type of theme I want.
    2. Set all style references throughout my project to DynamicResource instead of “StaticResource”.
    3. Use manipulation of ResourceDictionaries.

    In this example, I have themes for High, Medium, and Low quality. My style sheets paths are:

    • /Assets/Styles/GlobalStylesLow.xaml
    • /Assets/Styles/GlobalStylesMed.xaml
    • /Assets/Styles/GlobalStylesHigh.xaml

    The code for the manipulation works like this:

    /// <summary>
    /// Level of graphics quality enum.
    /// </summary>
    public enum GraphicsQuality
    {
        /// <summary>
        /// Low
        /// </summary>
        Low = 0,
    
        /// <summary>
        /// Medium
        /// </summary>
        Medium = 1,
    
        /// <summary>
        /// High
        /// </summary>
        High = 2
    }
    
    
    /// <summary>
    /// Sets the Application Resource Dictionaries based on selection.
    /// </summary>
    /// <param name="quality">The quality.</param>
    /// <param name="onRedraw">The on redraw.</param>
    public static void UpdateStyles(
        Enums.GraphicsQuality quality = Enums.GraphicsQuality.High, Action onRedraw = null)
    {
        // Reset resource dictionaries
        Application.Current.Resources.MergedDictionaries.Clear();
    
        // Base style path
        const string basePath = "/<project_base>;component/Assets/Styles";
    
        // Evaluate global quality
        switch (quality)
        {
            case Enums.GraphicsQuality.High:
                LoadStyle(basePath + "/GlobalStylesHigh.xaml");
                break;
    
            case Enums.GraphicsQuality.Medium:
                LoadStyle(basePath + "/GlobalStylesMed.xaml");
                break;
    
            case Enums.GraphicsQuality.Low:
                LoadStyle(basePath + "/GlobalStylesLow.xaml");
                break;
        }
    
        // Redraw
        if (onRedraw != null)
        {
            onRedraw();
        }
    }
    
    
    /// <summary>
    /// Loads a specific style by Uri.
    /// </summary>
    /// <param name="stylePath">The style path.</param>
    private static void LoadStyle(string stylePath)
    {
        var dic = new ResourceDictionary
        {
            Source = new Uri(stylePath, UriKind.Relative)
        };
        Application.Current.Resources.MergedDictionaries.Add(dic);
    }
    

    When the condition exists to change your StyleSheet, call UpdateStyles.

    Note:
    The onRedraw parameter is simply a final action to perform after updating the style. In some cases, you may want to pass

    this.InvalidateVisual
    

    from the UI if you are having issues with the UI properly updating.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Context: I'm developing a WPF application which will contain a lot of different screens.
I am developing an application in C# WPF which will have Client-Server architecture (Client
There is a need to develop WPF application which will support both mouse and
I am developing WPF application which will be executing on the 21-inch touch-screen. Along
We are developing a WPF application which uses Telerik's suite of controls and everything
I'm developing a WPF application which reads and writes XML data. I'm coming from
I'm developing an application using the WAF (WPF Application Framework) which is based on
I have an application which I am developing using WPF\Prism\MVVM. All is going well
i'm developing a WPF application which use Process.Start(cmd, /k ...); or Process.Start(cmd, /c ...);
I've started the development of a windows application, which target windows 7 and vista

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.