FontWeight Attribute Not Working [Windows Phone 8.1 Runtime]
The case is really trivial: the FontWeight attribute for TextBlock
doesn't work in a Universal Store app. I created a sample project (Universal App) and MainPage
added a TextBlock
style like this to WindowPhone :
<TextBlock HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize=20
FontWeight="Thin"
Text="Test text should be thin in runtime." />
Everything looks good in the designer, but when I deploy the app to the simulator / device, the test text is not diluted! This is normal. Check out the screenshot:
As you can see, in the designer, the text is completely thin (it's beautiful!). However, in the current simulator, the text is normal. Why is that? How can I get around this? Thanks in advance for any help.
source to share
This works well in WP8.0 Silverlight, but at runtime WP8.1 you need to apply to it as well <Style>
. Thus
<Grid x:Name="ContentPanel">
<StackPanel>
<TextBlock HorizontalAlignment="Left" VerticalAlignment="Center" FontSize="20" Text="Test text should be normal in runtime."/>
<!-- apply the a style like BodyTextBlockStyle -->
<TextBlock HorizontalAlignment="Left" VerticalAlignment="Center" FontSize="20"
Text="Test text should be thin in runtime."
FontWeight="Thin" Style="{StaticResource BodyTextBlockStyle}"/>
</StackPanel>
</Grid>
source to share