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)
In the interest of changing styles, I do the following:
In this example, I have themes for High, Medium, and Low quality. My style sheets paths are:
The code for the manipulation works like this:
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
from the UI if you are having issues with the UI properly updating.