Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 89864

Custom ButtonRenderer not called when my Activity inherits from FormsAppCompatActivity

$
0
0

My Custom ButtonRenderer does not get called since my Activity inherits from FormsAppCompatActivity instead of FormsApplicationActivity

Is this a known issue?

My custom renderer:

[assembly: ExportRenderer (typeof (Button), typeof (ButtonCustomRenderer))]
namespace MyApp.Droid
{
    public class ButtonCustomRenderer : ButtonRenderer
    {
        Android.Graphics.Typeface _typeFaceRegular = Android.Graphics.Typeface.CreateFromAsset (Android.App.Application.Context.Assets, "AbcTT-Regular_2_0.ttf");

        protected override void OnElementChanged (Xamarin.Forms.Platform.Android.ElementChangedEventArgs<Button> e)
        {
            base.OnElementChanged (e);

            Control.SetTypeface (_typeFaceRegular, Android.Graphics.TypefaceStyle.Normal);

            Control.StateListAnimator = null;
        }

        protected override void OnElementPropertyChanged (object sender, System.ComponentModel.PropertyChangedEventArgs e)
        {
            base.OnElementPropertyChanged (sender, e);
        }
    }
}

I already tried to change my usings from:
using Xamarin.Forms.Platform.Android;
to:
using Xamarin.Forms.Platform.Android.AppCompat;


Viewing all articles
Browse latest Browse all 89864

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>