Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

FontWeight attribute doesn't work [Windows Phone 8.1 Runtime]

The case is really trivial: FontWeight's attribute for TextBlock does not work in Universal Store App. I have created sample project (Universal App), and in the WindowPhone's MainPage added TextBlock styled like that:

<TextBlock HorizontalAlignment="Center"
           VerticalAlignment="Center"
           FontSize=20
           FontWeight="Thin"
           Text="Test text should be thin in runtime." />

In the designer everything looks fine, but when I deploy an app on a simulator/device, test text is not thinned! It's normal. Check out the screenshot:

SS from VS2013

As you can see, in the designer the text is perfectly thin (it's beautiful!). However in the running simulator text's weight is normal. Why's that? How can I workaround it? Thanks in advance for any help.

like image 750
Malutek Avatar asked Apr 12 '26 21:04

Malutek


1 Answers

It works pretty well in WP8.0 Silverlight but in WP8.1 run time, you'll need to apply a <Style> to it as well. Like so


<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>

enter image description here

like image 153
Chubosaurus Software Avatar answered Apr 15 '26 12:04

Chubosaurus Software



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!