Xamarin.Plugins icon indicating copy to clipboard operation
Xamarin.Plugins copied to clipboard

Fonts are not working on UWP App..

Open mikeimhof opened this issue 8 years ago • 5 comments

Created a very simple app but the icons are not working on windows app. I used your Page1.xaml and App.xaml.cs and the project compiles fine without errors but only shows [] where the icons should be. It runs fine on Android. I must be missing something...

Thanks in advance. capture

mikeimhof avatar Dec 29 '16 06:12 mikeimhof

Hi,

Copy iconize-fontawesome.ttf to resource folder, in iOS app work perfectly ;)

cresilva avatar Feb 11 '17 16:02 cresilva

Still doesn't work for me on UWP

Denny966 avatar Jun 22 '17 14:06 Denny966

I have this problem when run on Relase mode. On Debug mode works, but Release not work

linck avatar Sep 07 '17 17:09 linck

linck I have the same issue, works with Debug, but not release. did you ever resolve? i'm about to dive into the code and try to figure it out.

Update: while i have not been able to fix it, yet, it only fails when using"compile with .net native tool chain" which is on by default for release builds. if you uncheck it will work (and build 10 times faster) but you won't be able to publish to the store, so it's not a solution.

Update again Finally got it working! in your OnLaunched, replace your simple Xamarin.Forms.Forms.Init(e) with:

var assembliesToInclude = new List<Assembly>();

// Now, add in all the assemblies your app uses
assembliesToInclude.Add(typeof(FormsPlugin.Iconize.IconButton).Assembly);
assembliesToInclude.Add(typeof(FormsPlugin.Iconize.UWP.IconControls).Assembly);
assembliesToInclude.Add(typeof(Plugin.Iconize.IIconModule).Assembly);
assembliesToInclude.Add(typeof(Plugin.Iconize.UWP.IconizeExtensions).Assembly);
assembliesToInclude.Add(typeof(Plugin.Iconize.Fonts.FontAwesomeModule).Assembly);

//init xamarin with the UWP overload to include those assemblies
Xamarin.Forms.Forms.Init(e, assembliesToInclude);

The reason is kind of documented, but they use language like "might" and "maybe": https://developer.xamarin.com/guides/xamarin-forms/platform-features/windows/installation/universal/#Troubleshooting

if your UWP app is referencing multiple assemblies (for example third party control libraries, or your app itself is split into multiple libraries), Xamarin.Forms may be unable to load objects from those assemblies (such as custom renderers).

This might occur when using the Compile with .NET Native tool chain which is an option for UWP apps in the Properties > Build > General window for the project.

You can fix this by using a UWP-specific overload of the Forms.Init call in App.xaml.cs as shown in the code below (you should replace ClassInOtherAssembly with an actual class your code references):

TimBurris avatar Feb 01 '18 14:02 TimBurris

The UWP specific overload to load the plugin assemblies worked for me.

DuncanMcIntyre avatar Mar 02 '18 01:03 DuncanMcIntyre