Global font style in WPF

I have that thing in App.xaml

        <Style TargetType="{x:Type Window}">
            <Setter Property="FontFamily" Value="Consolas" />
        <Style TargetType="{x:Type UserControl}">
            <Setter Property="FontFamily" Value="Consolas" />

In theory all fonts now should be changed. In practice they are not. What am I doing wrong?


Set a style in ctor of MainWindow which inherits from Window.

public MainWindow()
    Style = (Style)FindResource(typeof(Window));

Similar for UserControl Style = (Style)FindResource(typeof(UserControl));

Leave a Reply

Your email address will not be published. Required fields are marked *