Telerik blogs

Have you ever had trouble with changing all fonts and font sizes in your UI? Well, this is no more trouble with Windows8 and Windows8Touch themes in Q1 2013!

For example, if you have the following UI:

Now here are the lines of code which will do the magic:


Windows8Palette.Palette.FontSize = 20;
Windows8Palette.Palette.FontFamily = new FontFamily("Microsoft Sans Serif");

And here is the result:

 How is this possible?

As described in our online documenation all Telerik controls use resources that are linked to one major singleton object that contains the FontSize/FontFamily properties used for both themes. They are public so you can easily modify those theme resources at one single point. The most commonly used FontSize in both themes is named FontSize and the most commonly used FontFamily resource is FontFamily set to Segoe UI. Bigger FontSizes are used for Headers, Footers. Respectively smaller FontSizes are used for complex controls such as RibbonView, Gauge etc. You may see here these resources and their default values for Windows8 and Windows8Touch Themes. You can modify each of them based on your needs.

This is very cool but why don’t all themes have this feature?

Well, the mechanism we used to enable this is quite complex and it turned out that only these two themes are compliant with all requirements for this feature to work. Moreover we do not want to introduce any breaking changes with the other themes. You can expect to see more new themes do this neatly in the future.

Do you find this new feature useful? Do you want to see any other enhancements in our theming? If yes, please leave a comment!


About the Author

Andrey Andreev

Software Developer,
Centaur Team

Comments

Comments are disabled in preview mode.