Setting a font size for the entire application

1 Answer 4 Views
General Discussions
Guillermo
Top achievements
Rank 1
Guillermo asked on 15 Jul 2025, 09:16 PM

I am using the Material Theme, here's my app.xaml code


<Application x:Class="Desktop_Application.App"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <Application.Resources>
        
        <ResourceDictionary>
            <!-- Global default font size -->
            <Style TargetType="{x:Type Control}">
                <Setter Property="FontSize" Value="8"/>
            </Style>
            
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="/Telerik.Windows.Themes.Material;component/Themes/System.Windows.xaml"/>
                <ResourceDictionary Source="/Telerik.Windows.Themes.Material;component/Themes/Telerik.Windows.Controls.Chart.xaml"/>
                <ResourceDictionary Source="/Telerik.Windows.Themes.Material;component/Themes/Telerik.Windows.Controls.Data.xaml"/>
                <ResourceDictionary Source="/Telerik.Windows.Themes.Material;component/Themes/Telerik.Windows.Controls.FixedDocumentViewers.xaml"/>
                <ResourceDictionary Source="/Telerik.Windows.Themes.Material;component/Themes/Telerik.Windows.Controls.GridView.xaml"/>
                <ResourceDictionary Source="/Telerik.Windows.Themes.Material;component/Themes/Telerik.Windows.Controls.ImageEditor.xaml"/>
                <ResourceDictionary Source="/Telerik.Windows.Themes.Material;component/Themes/Telerik.Windows.Controls.Input.xaml"/>
                <ResourceDictionary Source="/Telerik.Windows.Themes.Material;component/Themes/Telerik.Windows.Controls.Navigation.xaml"/>
                <ResourceDictionary Source="/Telerik.Windows.Themes.Material;component/Themes/Telerik.Windows.Controls.xaml"/>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Application.Resources>
</Application>
However, the application does not reflect the new font size, is there a way to do it?

1 Answer, 1 is accepted

Sort by
0
Martin Ivanov
Telerik team
answered on 16 Jul 2025, 08:56 AM

Hello Guillermo,

I am afraid that setting the FontSize won't be as straightforward as using an implicit style targetting all Control elements. One of the reasons is that the implicit style (a Style withou x:Key set) has one of the lowest setting priorities in the DependencyProperty system of WPF. A lot of elements use an explicit style assinged by its x:Key or a direct FontSize setting, which will easily override the global setting. Not to mention that the implicit styles are very specific when it comes to the TargetType and they are applied only on the concrete type. For example, the style in the snippet will be applied only to the Control element, but not to any class that inherits it.

To achieve your requirement, you will need to tackle the different types of controls separately and sometimes using different approaches.

You can also set the FontSize of the Telerik Material palette. This will change the font of most Telerik elements.

MaterialPalette.Palette.FontSizeS = 8; 
MaterialPalette.Palette.FontSize = 8; 
MaterialPalette.Palette.FontSizeL = 8; 

Regards,
Martin Ivanov
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Guillermo
Top achievements
Rank 1
commented on 16 Jul 2025, 05:23 PM

Thank you for the response.

I'm assuming that FontSizeS is for Small, FontSize is for Medium and FontSizeL is for Large?

Is there a way you can give me examples of what is using FontSizeS, and FontSizeL?

Tags
General Discussions
Asked by
Guillermo
Top achievements
Rank 1
Answers by
Martin Ivanov
Telerik team
Share this question
or