0

I'm creating a Custom renderer on android and uwp. Things go well on uwp. But when it comes to Android. The Control property doesn't get recognized it says: "The name 'Control' is not recognized in the current context".

This is the code i have written:

protected override void OnElementChanged(ElementChangedEventArgs<BoxView> e)
    {
        base.OnElementChanged(e);

        if (Control != null)
        {
            var gradientBoxView = Element as GradientBoxView;

            var linearGradient = gradientBoxView.Color;

            //colors
            var nativeColors = linearGradient.LinearGradientStops.Select(gs => gs.Color).ToArray();

            int[] colors = new int[nativeColors.Count()];
            for (int i = 0; i < nativeColors.Length; i++)
                colors[i] = nativeColors[i].ToAndroid();

            var gradient = new GradientDrawable(Utils.AndroidUtils.ToGradientDrawableFlow(linearGradient.Flow), colors);

            Control.SetBackgroundDrawable(gradient);
}

Any help ?

Adham Ali
  • 81
  • 8

0 Answers0