question

EduardoGomez-1870 avatar image
0 Votes"
EduardoGomez-1870 asked WenyanZhang-MSFT commented

Displaying Glyth

Hello everyone

I am trying to Display a Glyth, but I cannot

111657-screenshot-2021-07-04-223459.png



I use this, to generate my icons

https://andreinitescu.github.io/IconFont2Code/

dotnet-xamarin
· 7
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

I use the material design icons

0 Votes 0 ·

Do you mean "glyph" instead of "glyth"? Maybe you could specify the font family to which the font icon belongs. In addition, you can refer to
https://stackoverflow.com/questions/61258115/fontawesome-xamarin-setting-glyph-not-working-from-code-behind
https://docs.microsoft.com/en-us/xamarin/xamarin-forms/user-interface/text/fonts

0 Votes 0 ·

I did this, but it doesn't show up

  Glyph = new FontImageSource {
                     Glyph = IconFonts.Grid,
                     FontFamily = "material",
                     Size = 44![111797-screenshot-2021-07-05-102504.png][1]
                 };

  x:DataType="vm:NotesVM"
              xmlns:syncfusion="clr-namespace:Syncfusion.ListView.XForms;assembly=Syncfusion.SfListView.XForms">
    
     <ContentPage.ToolbarItems>
         <ToolbarItem Command="{x:Binding ChangeLayoutCommand}">
             <ToolbarItem.IconImageSource>
                 <FontImageSource Glyph="{x:Binding Glyph}"/>
             </ToolbarItem.IconImageSource>
         </ToolbarItem>
     </ContentPage.ToolbarItems>
    
     <ContentPage.BindingContext>
         <vm:NotesVM/>
     </ContentPage.BindingContext>
     <ContentPage.Content>


[1]: /answers/storage/attachments/111797-screenshot-2021-07-05-102504.png

0 Votes 0 ·

I did what you told me but it doesn't show up

View Model

   Glyph = IconFonts.Grid,
                     FontFamily = "material",
                     Size = 44


My view

 <ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
              xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
              x:Class="Safe.View.NotesPage"
              xmlns:vm="clr-namespace:Safe.ViewModel" 
              xmlns:model="clr-namespace:Safe.Model"
              xmlns:fi="clr-namespace:MaterialFonts.Fonts"
              Visual="Material"
              Title="Notes"
              x:DataType="vm:NotesVM"
              xmlns:syncfusion="clr-namespace:Syncfusion.ListView.XForms;assembly=Syncfusion.SfListView.XForms">
    
     <ContentPage.ToolbarItems>
         <ToolbarItem Command="{x:Binding ChangeLayoutCommand}">
             <ToolbarItem.IconImageSource>
                 <FontImageSource Glyph="{x:Binding Glyph}"/>
             </ToolbarItem.IconImageSource>
         </ToolbarItem>
     </ContentPage.ToolbarItems>




0 Votes 0 ·

Is the value of Glyph "\u000f02c1"? It should be escaped in XAML.

0 Votes 0 ·
Show more comments

0 Answers