Unable to style a renderer

TheGreatOneTheGreatOne USMember ✭✭
edited January 2018 in Xamarin.Forms

I'm unable style a renderer. I received the following exception:
Xamarin.Forms.Xaml.XamlParseException
The PropertyName of GradientButton.StartColorProperty is not StartColor

Am I missing something?

App.xaml

<Style
                x:Key="GradientStyle"
                TargetType="renderer:GradientButton">
                <Setter
                    Property="StartColor"
                    Value="#000000"/>
                <Setter
                    Property="EndColorProperty"
                    Value="#ffffff"/>

Button.cs

public class GradientButton : Button
    {
        public static BindableProperty StartColorProperty = BindableProperty.Create(nameof(Color), typeof(Color), typeof(GradientButton), default(Color), BindingMode.OneWay);

        public static BindableProperty EndColorProperty = BindableProperty.Create(nameof(Color), typeof(Color), typeof(GradientButton), default(Color), BindingMode.OneWay);

        public Color StartColor
        {
            get { return (Color)GetValue(StartColorProperty); }
            set { SetValue(StartColorProperty, value); }
        }

        public Color EndColor
        {
            get { return (Color)GetValue(EndColorProperty); }
            set { SetValue(EndColorProperty, value); }
        }
    }

Best Answer

Answers

Sign In or Register to comment.