Home > Net >  Xamarin Forms, "Invalid syntax for a hexadecimal numeric entity reference" error inside Ap
Xamarin Forms, "Invalid syntax for a hexadecimal numeric entity reference" error inside Ap

Time:05-12

the font.otf is imported correctly and placed inside the correct folder because the font works on letters but importing an icon from the otf file does not work because of the syntax error. Entering &#x before the icon code "uf1ea" is what caused the error but it's important for finding the icon otherwise it would just display "uf1ea" on the emulator and not the actual icon.

here's a snippet of the code i wrote in app.xaml :

    <?xml version="1.0" encoding="utf-8" ?>
<Application xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             x:Class="testingfont.App">
    <Application.Resources>
        <ResourceDictionary>
            <x:String x:Key="Newspaper">&#xuf1ea;</x:String>
        </ResourceDictionary>
    </Application.Resources>
</Application>

CodePudding user response:

You don't need to add a u in your icon code, just use it like below:

<x:String x:Key="Newspaper">&#xf1ea;</x:String>

CodePudding user response:

After adding the icon codes in a new class, this worked for me:

<Label Text="&#xf1ea;"/> 
  • Related