Windows Phone 8中自定义字体的使用 [英] Custom font usage in Windows Phone 8

查看:188
本文介绍了Windows Phone 8中自定义字体的使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个奇怪的问题与Windows Phone 8模拟器!
我有一个小的测试应用程序,我在主页上更改页面名称文本框,以便显示使用自定义字体。
现在在Visual Studio设计器中,我看到字体和运行应用程序时,我也在模拟器中看到它,所以一切都很好...



但是当我将主页面移动到名为View的文件夹中,并更改WMAppManifest.xml以反映此移动>导航页面现在设置为View / MainPage.xaml。
我仍​​然在我的设计器中看到这个自定义字体,但在模拟器中不再有效了!



我没有wp8设备。 。所以任何人都可以验证这个对我来说,如果这个问题是相同的,当你尝试将失败的项目部署到手机?

有没有人有任何线索为什么这正在发生?非常烦人,无法在模拟器中看到正确的设计。



工作和失败的项目

解决方案

确定找到解决方案我自己...这是因为参考styles.xaml里面的字体。



它应该是一个完整的路径!
因此而不是设置:

 < Setter Property =FontFamilyValue =Fonts / ClementePDae-Light。 ttf#ClementePDae/> 

设定这个:

 < Setter Property =FontFamilyValue =/ PhoneApp1; component / Fonts / ClementePDae-Light.ttf#ClementePDae/> 

比一切正常!


I have a weird problem with the Windows Phone 8 emulator! I have a small test app where I change the 'page name' textbox on the mainpage so that it shows using a custom font. Now in the visual studio designer I see that font and when running the app I also see it in the emulator, so all is well...

But when I move the main page into a folder called View and change the WMAppManifest.xml to reflect this move > Navigation page is now set to View/MainPage.xaml. I'm still seeing this custom font in my designer, but not anymore in the emulator!!

I don't own a wp8 device yet... so can anyone verify this for me, if this problem is the same when you try to deploy the failure project to the phone?

And does anybody have any clue why this is happening? Very annoying not able to see the correct design in the emulator.

Working and failing projects

解决方案

Ok found the solution myself... it's because of the reference to the font inside the styles.xaml.

It should be a full path! So instead of setting:

<Setter Property="FontFamily" Value="Fonts/ClementePDae-Light.ttf#ClementePDae" />

Set this:

<Setter Property="FontFamily" Value="/PhoneApp1;component/Fonts/ClementePDae-Light.ttf#ClementePDae" />

Than everything works!

这篇关于Windows Phone 8中自定义字体的使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆