Hello everyone,
after I wrote my own custom renderer for a Button my OnClick events are not triggering anymore. Does anyone had the same problem before or know what I could try?
public class ButtonStyled : Button
{
public double FontSize { get; set; }
public ButtonStyled() : base()
{
FontSize = 16;
}
}
public class ButtonStyledRenderer : ViewRenderer<ButtonStyled, global::Android.Widget.Button>
{
public ButtonStyledRenderer()
{
}
public override void ChildDrawableStateChanged(global::Android.Views.View child)
{
base.ChildDrawableStateChanged(child);
Control.Text = Control.Text;
}
protected override void OnElementChanged(ElementChangedEventArgs<ButtonStyled> e)
{
base.OnElementChanged(e);
if (e.OldElement == null)
{
// perform initial setup
SetNativeControl(new global::Android.Widget.Button(Forms.Context));
}
ButtonStyled buttonStyled = this.Element;
Control.Text = buttonStyled.Text;
Control.TextSize = (float)buttonStyled.FontSize;
Control.Typeface = Typeface.CreateFromAsset(Context.Assets, "Fonts/harabara.ttf");
}
}