I have that thing in App.xaml
<Application.Resources> <Style TargetType="{x:Type Window}"> <Setter Property="FontFamily" Value="Consolas" /> </Style> <Style TargetType="{x:Type UserControl}"> <Setter Property="FontFamily" Value="Consolas" /> </Style> </Application.Resources>
In theory all fonts now should be changed. In practice they are not. What am I doing wrong?
Answer
Set a style in ctor of MainWindow
which inherits from Window
.
public MainWindow() { InitializeComponent(); Style = (Style)FindResource(typeof(Window)); .... }
Similar for UserControl
Style = (Style)FindResource(typeof(UserControl));