2

According to this post: https://devblogs.microsoft.com/xamarin/embedded-fonts-xamarin-forms/

The new way to add a custom font is to add the font as an embeddedResource and then add this line in App.xaml.ca:

[assembly: ExportFont("DSEG7ModernRegular.ttf")]

But I get this error:

Error   CS0246  The type or namespace name 'ExportFontAttribute' could not be found (are you missing a using directive or an assembly reference?)

My project references:

  • Xamarin.Essentials (1.3.1)
  • Xamarin.Forms (4.4.0.991265) - 4.5
  • NetStandard.Library (2.0.3)
6
  • "In this post we will see how to use it in Xamarin.Forms 4.5.530 and up." Commented Apr 10, 2020 at 20:05
  • So... where that version then??????? Commented Apr 10, 2020 at 20:41
  • 1
    I'm going to assume that's a typo and he means 4.5.0.530 - nuget.org/packages/Xamarin.Forms/4.5.0.530 Commented Apr 10, 2020 at 20:44
  • Updated to 4.5.0.617 and still the same problem...Weird ... Commented Apr 10, 2020 at 21:13
  • 1
    it's in the release notes for that build - learn.microsoft.com/en-us/xamarin/xamarin-forms/release-notes/…. It should be in the main Xamarin.Forms namespace - I assume you have using Xamarin.Forms; in the file? You might try the usual tricks of restarting VS, clearing bin/obj folders, etc Commented Apr 10, 2020 at 21:17

1 Answer 1

2

ExportFontAttribute is in the Xamarin.Forms namespace, so be sure you have

using Xamarin.Forms;
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.