Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 75885

Custom Bindable Property Type Mismatch

$
0
0

I'm having an issue creating a BindableProperty on a custom view. I used a working piece of code as a template and am nearly positive it's a match but there is still the type mismatch error on the binding.

PortfolioHeaderView Property code:

public static readonly BindableProperty PortfolioHeaderProperty =
            BindableProperty.Create("HeaderModel", typeof(PortfolioHeader), typeof(PortfolioHeaderView), null);

public PortfolioHeader HeaderModel 
        {
            get
            {
                return (PortfolioHeader)GetValue(PortfolioHeaderProperty);
            }
            set
            {
                SetValue(PortfolioHeaderProperty, value);
            }
        }

ViewModel Source:

public class PortfolioLandingViewModel 
    {
        public PortfolioHeader HeaderInfo {get; set;}
    }

XAML in page containing the custom view:

<local:PortfolioHeaderView HeightRequest="300" HorizontalOptions="FillAndExpand" HeaderModel="{Binding HeaderInfo}"/>

Exception:

Position 18:83. Cannot assign property "HeaderModel": type mismatch between "Xamarin.Forms.Binding" and "CSSPMobile.PortfolioHeader"

Not sure why it's giving me the type mismatch, hoping another set of eyes may be able to spot something I'm missing.


Viewing all articles
Browse latest Browse all 75885

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>