Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/xamarin/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Xaml 在Xamarin中添加自定义字体_Xaml_Xamarin_Resources_Custom Font_Xamarin.essentials - Fatal编程技术网

Xaml 在Xamarin中添加自定义字体

Xaml 在Xamarin中添加自定义字体,xaml,xamarin,resources,custom-font,xamarin.essentials,Xaml,Xamarin,Resources,Custom Font,Xamarin.essentials,根据这篇文章: 添加自定义字体的新方法是将字体添加为嵌入式资源,然后在App.xaml.ca中添加此行: [assembly: ExportFont("DSEG7ModernRegular.ttf")] 但我得到了这个错误: Error CS0246 The type or namespace name 'ExportFontAttribute' could not be found (are you missing a using directive or an assembly re

根据这篇文章:

添加自定义字体的新方法是将字体添加为嵌入式资源,然后在App.xaml.ca中添加此行:

[assembly: ExportFont("DSEG7ModernRegular.ttf")]
但我得到了这个错误:

Error   CS0246  The type or namespace name 'ExportFontAttribute' could not be found (are you missing a using directive or an assembly reference?)
我的项目参考:

  • Xamarin.基本要素(1.3.1)
  • Xamarin.表格(4.4.0.991265)-4.5
  • NetStandard.Library(2.0.3)

ExportFontAttribute
位于
Xamarin.Forms
命名空间中,因此请确保

using Xamarin.Forms;

ExportFontAttribute
位于
Xamarin.Forms
命名空间中,因此请确保

using Xamarin.Forms;

“在这篇文章中,我们将看到如何在Xamarin.Forms 4.5.530和更高版本中使用它。”。。。那个版本在哪里?我想这是一个打字错误,他的意思是4.5.0.530-更新到4.5.0.617,仍然是相同的问题…奇怪…它在那个版本的发行说明中-。它应该在主Xamarin.Forms命名空间中-我假设您已经使用了
Xamarin.Forms在文件中?您可以尝试重启VS、清除bin/obj文件夹等常见技巧“在本文中,我们将了解如何在Xamarin.Forms 4.5.530及更高版本中使用它。”。。。那个版本在哪里?我想这是一个打字错误,他的意思是4.5.0.530-更新到4.5.0.617,仍然是相同的问题…奇怪…它在那个版本的发行说明中-。它应该在主Xamarin.Forms命名空间中-我假设您已经使用了
Xamarin.Forms在文件中?您可以尝试重新启动VS、清除bin/obj文件夹等常用技巧