CharacterSpacing is not inherited from container
Posted: 06 May 2024, 12:28
Hi!
TextBlock element has some magic (which I still don't fully understand) that allows it to inherit various properties from ContentControl.
For example here it inherits foreground and font size from Button.
However this magic doesn't seem to work with CharacterSpacing attached property (using latest Noesis 3.2.3).
So far I worked around this issue by setting TextBlock's style like this in ContentPresenter's resources:
but this is really ugly.
Is it a bug or by design? And maybe there is a better workaround I missed?
TextBlock element has some magic (which I still don't fully understand) that allows it to inherit various properties from ContentControl.
For example here it inherits foreground and font size from Button.
However this magic doesn't seem to work with CharacterSpacing attached property (using latest Noesis 3.2.3).
Code: Select all
<StackPanel>
<Button Width="300">
<TextBlock Foreground="Blue" FontSize="30" noesis:Text.CharacterSpacing="1000">Test</TextBlock>
</Button>
<Button Width="300" Foreground="Blue" FontSize="30" noesis:Text.CharacterSpacing="1000" Content="Test" />
</StackPanel>
Code: Select all
<Style TargetType="TextBlock">
<Setter Property="noesis:Text.CharacterSpacing" Value="{Binding (noesis:Text.CharacterSpacing), RelativeSource={RelativeSource AncestorType=ContentControl}}"/>
</Style>
Is it a bug or by design? And maybe there is a better workaround I missed?