title: FontAwesome / Xamarin - Setting Glyph not working from code behind
body: <p>I missing something here when using FontAwesome on Xamarin... the buttons work fine when setting from xaml file but when I try to set from code behind it doesn't show the icon, here is the scenario:</p>
  
  <p>button <em>working</em> fine:</p>
  
  <pre><code>&lt;Button Grid.Row="0" Grid.Column="4" x:Name="btnIdDav" Padding="10" Margin="3" TextColor="#FFF" BackgroundColor="#565C5A" Clicked="btnIdDav_Clicked" WidthRequest="45"&gt;
     &lt;Button.ImageSource&gt;
        &lt;FontImageSource FontFamily="{StaticResource FontAwesomeSolidOTF}" Glyph="&amp;#xf039;" Color="#fff"/&gt;
     &lt;/Button.ImageSource&gt;
  &lt;/Button&gt;
  </code></pre>
  
  <p>Last time I had to set Glyph from code, I had to do a bad 'workaround' with converter in order to show it, and it <em>worked</em> (icon is showing) in the end:</p>
  
  <pre><code>public const string _dollarGlyph = "\uf155";
  public const string _percGlyph = "\uf541";
  </code></pre>
  
  <pre><code> public class DescGlyphConverter : IValueConverter
      {
          public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
          {
              return value;
          }
  
          public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
          {
              throw new NotImplementedException();
          }
      }
  </code></pre>
  
  <pre><code>Glyph="{Binding DescImage, Converter={StaticResource Key=desconto}}
  </code></pre>
  
  <p><em>NOW</em> I want to create a custom button and set the Glyph but the icon is not appearing (tested with both OTF and TTF files):</p>
  
  <pre><code>public static FontImageSource GetImgSource()
          {
              FontImageSource source = new FontImageSource();
              source.FontFamily = Application.Current.Resources["FontAwesomeSolidTTF"].ToString();
              source.Glyph = "\uf3e5";
              source.Color = Color.FromHex("#fff");
              return source;
          }
  
          public static Style BtnBack() {
              return new Style(typeof(Button))
              {
                  Setters = {
                      new Setter { Property = Button.ContentLayoutProperty, Value = new ButtonContentLayout(ButtonContentLayout.ImagePosition.Top, 5) },
                      new Setter { Property = Button.TextProperty, Value = "Back" },
                      new Setter { Property = Button.ImageSourceProperty, Value = GetImgSource()},
                  }
              };
          }
  </code></pre>
  
  <p>Any sugestions?
  Thanks!</p>