Reference custom view in other project with custom font

回眸只為那壹抹淺笑 提交于 2019-12-25 08:36:42

问题


I am making WPF program. I have project where I have custom TextBlock control with custom font (font-awesome), I add this project in references of another project and add this custom control in this new project but the font is not shown. It is just square. I have set build action as Resource and Do not copy to output directory. What am I doing wrong? Both projects are class libraries. And I use them in other project (all these done for Prism)


回答1:


Make sure that the Build Action property of the font is set to Resource and that you reference the custom font using a pack URI as suggested here:

Using custom font in WPF application: http://geekswithblogs.net/Martinez/archive/2010/01/29/custom-font-in-wpf-application.aspx

<TextBlock FontFamily="pack://application:,,,/Folder1/#Katana">Text</TextBlock>

Please refer to the link for more information.



来源:https://stackoverflow.com/questions/42121086/reference-custom-view-in-other-project-with-custom-font

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!