Home > OS >  No property, BindableProperty, or event found for "IMGSource", or mismatching type between
No property, BindableProperty, or event found for "IMGSource", or mismatching type between

Time:01-02

I have added a image property as a Bindable Property, in that property the image will get bind by the backend where in the list we are getting image in URI form.(Below is the link of image) "http://103.117.66.70:5002/AllMedia/Categories/1ij0oc2022_12_29_img.png"

My Bindable Property code is Below:-

This Image is defined in one custom ContentView where i am binding this custom Content View in one page.

    <Image Source="{Binding Source={x:Reference This}, Path=IMGSource}" Aspect="AspectFill"/>
    
    public static readonly BindableProperty IMGSourceBindablePropertyProperty = BindableProperty.Create(nameof(IMGSource), typeof(Uri), typeof(Uri));
            public Uri IMGSource
            {
                get { return (Uri)GetValue(IMGSourceBindablePropertyProperty); }
                set { SetValue(IMGSourceBindablePropertyProperty, value); }
            }

MainPage.xmal


<control:Accordion FrameEye="True" GridTitle="{Binding title}" IMGSource="{Binding RowImg}" GridTitleFontSize="16" HorizontalOptions="CenterAndExpand" VerticalOptions="EndAndExpand"/>

CodePudding user response:

The problem is the name of your IMGSourceBindablePropertyProperty and declaring type.

The naming convention for bindable properties is that the bindable property identifier must match the property name specified in the Create method, with "Property" appended to it. Check here

It should look like

public static readonly BindableProperty IMGSourceProperty = 
                BindableProperty.Create(nameof(IMGSource), typeof(string), typeof(Accordion));

public string IMGSource
{
    get { return (string)GetValue(IMGSourceProperty); }
    set { SetValue(IMGSourceProperty, value); }
}
  • Related