Пример #1
0
 protected override void OnElementPropertyChanged(PropertyChangedEventArgs args)
 {
     if (args.PropertyName == CustomFontEffect.FontFileNameProperty.PropertyName)
     {
         Typeface font = Typeface.CreateFromAsset(Forms.Context.ApplicationContext.Assets, "Fonts/" + CustomFontEffect.GetFontFileName(Element) + ".ttf");
         control.Typeface = font;
     }
 }
Пример #2
0
 protected override void OnAttached()
 {
     try
     {
         control = Control as TextView;
         Typeface font = Typeface.CreateFromAsset(Forms.Context.Assets, "Fonts/" + CustomFontEffect.GetFontFileName(Element) + ".ttf");
         control.Typeface = font;
     }
     catch (Exception ex)
     {
         Console.WriteLine("Cannot set property on attached control. Error: ", ex.Message);
     }
 }