[英]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. 此案是真是小巫见大巫:fontWeight设置对属性
TextBlock
不通用商店App工作。 I have created sample project (Universal App), and in the WindowPhone's MainPage
added TextBlock
styled like that: 我创建了示例项目(Universal App),并在WindowPhone的
MainPage
添加了TextBlock
样式:
<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:
看看截图:
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.
在此先感谢您的帮助。
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. 它在WP8.0 Silverlight中运行良好,但在WP8.1运行时,你也需要对它应用
<Style>
。 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>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.