Quantcast
Viewing latest article 40
Browse Latest Browse All 77050

Custom Control Error only by Color Property

Hi folks, i get this Error
XFC0009 No property, BindableProperty, or event found for "Attractive_BarColorLvl_1", or mismatching type between value and property.
if i try to set a Binding to my Property (Attractive_BarColorLvl_1).

Even code with small adjustments works wonderfully with ImageSource and String.

What i do wrong ?

My Code:

public static readonly BindableProperty BarColorProperty = BindableProperty.Create(
propertyName: nameof(Attractive_BarColorLvl_1),
returnType: typeof(Color),
declaringType: typeof(RatingBar),
defaultValue: default(Color),
defaultBindingMode: BindingMode.OneWay,
propertyChanged: ImageSourcePropertyChanged);

    public Color Attractive_BarColorLvl_1
    {
        get
        { return (Color)GetValue(BarColorProperty); }
        set
        { SetValue(BarColorProperty, value); }

    }

    private static void ImageSourcePropertyChanged(BindableObject bindable, object oldValue, object newValue)
    {
        var control = (RatingBar)bindable;
        control.Attractive_BarLvl_1.BackgroundColor = Color.FromHex(newValue.ToString());
    }

Viewing latest article 40
Browse Latest Browse All 77050

Trending Articles