-
-
Notifications
You must be signed in to change notification settings - Fork 948
In WPF-UI version 4.0.3, it is no longer possible to override global control styles (e.g., TextBlock.FontSize) from App.xaml using implicit styles #1459
Description
Describe the bug
First of all, thank you for your continued work on WPF-UI — it's a fantastic library that has greatly improved the developer experience in our WPF projects.
In WPF-UI version 4.0.3, setting a global implicit style for ui:TextBlock in App.xaml does not override the default FontSize applied by the library. Even after explicitly defining a style like this:
<Style TargetType="ui:TextBlock">
<Setter Property="FontSize" Value="40" />
</Style>the actual FontSize of ui:TextBlock elements remains 14, as confirmed in the Properties window at runtime.
This behavior differs from WPF-UI 3.x and even 4.0.0, where such global styles were correctly applied.
To Reproduce
For example, in App.xaml:
Add an implicit style for ui:TextBlock with FontSize = 40 in App.xaml.
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<!--<ResourceDictionary
Source="pack://application:,,,/Wpf.Ui;component/Resources/Wpf.Ui.xaml" />-->
<ResourceDictionary
Source="pack://application:,,,/Wpf.Ui;component/Controls/TextBlock/TextBlock.xaml" />
<ResourceDictionary
Source="pack://application:,,,/Wpf.Ui;component/Controls/TextBox/TextBox.xaml" />
<ui:ControlsDictionary />
</ResourceDictionary.MergedDictionaries>
<Style
TargetType="ui:TextBlock">
<Setter Property="FontSize" Value="40" />
</Style>
<Style
TargetType="TextBlock">
<Setter Property="FontSize" Value="40" />
</Style>
</ResourceDictionary>
</Application.Resources>
in MainWindow.xaml:
<StackPanel
HorizontalAlignment="Center"
VerticalAlignment="Center"
Orientation="Horizontal">
<StackPanel
Margin="8">
<ui:TextBlock
Text="ui:TextBlock A" />
<ui:TextBlock
FontSize="30"
Text="ui:TextBlock B" />
</StackPanel>
<StackPanel
Margin="8">
<TextBlock
Text="TextBlock A" />
<TextBlock
FontSize="30"
Text="TextBlock B" />
</StackPanel>
</StackPanel>Expected behavior
The FontSize of ui:TextBlock should reflect the value defined in App.xaml — in this case, 40 — and should be visible as such in the property panel at runtime.
Screenshots
OS version
Windows 11
.NET version
net9.0
WPF-UI NuGet version
4.0.3
Additional context
No response


