title: Xamarin Forms No property, bindable property, or event found for 'Sku', or mismatching type between value and property
body: <p>In my xamarin project I have a custom button controller:
  </p>
  
  <pre class="lang-cs prettyprint-override"><code>[XamlCompilation(XamlCompilationOptions.Compile)]
      public class AddToCartButton : Button
      {
          public static readonly BindableProperty SkuPoperty = BindableProperty.Create(nameof(Sku), typeof(ApiModels.SkuDetailModel), typeof(AddToCartButton));
  
          public ApiModels.SkuDetailModel Sku
          {
              get { return (ApiModels.SkuDetailModel)GetValue(SkuPoperty); }
              set { SetValue(SkuPoperty, value); }
          }
  
          public AddToCartButton()
          {
              this.Clicked += AddToCartButton_Clicked;
          }
  
          public AddToCartButton(ApiModels.SkuDetailModel sku)
          {
              this.Sku = sku;
              this.Clicked += AddToCartButton_Clicked;
          }
  
          private async void AddToCartButton_Clicked(object sender, EventArgs e)
          {
              var response = await Helpers.ApiHelper.CurrentAccess.AddToCart(new List&lt;ApiModels.CartItem&gt;() {
                  new ApiModels.CartItem() {
                      ItemCode = Sku.ItemCode,
                      Quantity = 1
                  }
              });
              // handle add modal
          }
      }
  </code></pre>
  
  <p>This is the exact same way I've created BindableProperties for ContentViews and what have you.</p>
  
  <p>In my xaml referencing this controller, I have:
  </p>
  
  <pre class="lang-cs prettyprint-override"><code>&lt;local:AddToCartButton Text="Add to Cart" Style="{ DynamicResource SkuAddToCart }" Sku="{Binding Sku}" /&gt;
  </code></pre>
  
  <p>This line is causing my builds to fail, with the error:
  <code>Severity   Code    Description Project File    Line    Suppression State
  Error       Position 44:44. No property, bindable property, or event found for 'Sku', or mismatching type between value and property....</code></p>
  
  <p>I can't seem to figure out why I'm getting it. All my types are consistent. The object I'm trying to bind is done like this:
  
      public partial class SkuView : ContentView
          {
              public ApiModels.SkuDetailModel Sku { get; set; }</p>
  
  <pre class="lang-cs prettyprint-override"><code>        public SkuView(ApiModels.SkuDetailModel sku, string baseUrl, ApiModels.SimpleUser user)
          {
              BindingContext = this;
              Sku = sku;
              InitializeComponent();
  </code></pre>
  
  <p>Per request for xaml headers, here is the entire xaml file.</p>
  
  <p><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;</code>
  </p>
  
  <pre class="lang-cs prettyprint-override"><code>&lt;ContentView xmlns="http://xamarin.com/schemas/2014/forms" 
           xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
           xmlns:local="clr-namespace:myApp.Controls"
           x:Class="myApp.Views.Products.SkuView"&gt;
  &lt;ContentView.Content&gt;
      &lt;StackLayout&gt;
          &lt;Grid Style="{ DynamicResource SkuGrid }"&gt;
              &lt;Grid.ColumnDefinitions&gt;
                  &lt;ColumnDefinition Width="100" /&gt;
                  &lt;ColumnDefinition Width="*" /&gt;
              &lt;/Grid.ColumnDefinitions&gt;
              &lt;Grid.RowDefinitions&gt;
                  &lt;RowDefinition Height="*" /&gt;
                  &lt;RowDefinition Height="50" /&gt;
              &lt;/Grid.RowDefinitions&gt;
  
              &lt;StackLayout x:Name="ImageCell" Grid.Row="0" Grid.Column="0"&gt;&lt;/StackLayout&gt;
              &lt;StackLayout x:Name="ContentCell" Grid.Row="0" Grid.Column="1"&gt;
                  &lt;Label x:Name="DescriptionLabel" Style="{ DynamicResource SkuDescLabel }" /&gt;
                  &lt;Label x:Name="ItemCodeLabel" Style="{ DynamicResource SkuItemCode }" /&gt;
                  &lt;StackLayout x:Name="PricingLayout"&gt;
                      &lt;!--&lt;StackLayout Orientation="Horizontal"&gt;
                          &lt;Label x:Name="PriceLabel" Style="{ DynamicResource SkuPricing }" /&gt;
                          &lt;Label x:Name="PurchaseMultipleLabel" Style="{ DynamicResource SkuUom }" /&gt;
                      &lt;/StackLayout&gt;--&gt;
                  &lt;/StackLayout&gt;
              &lt;/StackLayout&gt;
              &lt;StackLayout Orientation="Horizontal" Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2"&gt;
                  &lt;StackLayout Orientation="Horizontal" HorizontalOptions="FillAndExpand"&gt;
                      &lt;Button Text=" - " Style="{ DynamicResource SkuQtyStepper }" /&gt;
                      &lt;Grid Margin="-10, 0"&gt;
                          &lt;BoxView Color="DarkGray" Opacity=".6" Margin="0, 5"/&gt;
                          &lt;BoxView Color="White" Margin="2, 7"/&gt;
                          &lt;local:BorderlessEntry Style="{ DynamicResource SkuQtyEntry }" Keyboard="Numeric" Margin="2" HorizontalTextAlignment="Center" /&gt;
                      &lt;/Grid&gt;
                      &lt;Button Text=" + " Style="{ DynamicResource SkuQtyStepper }" /&gt;
                  &lt;/StackLayout&gt;
                  &lt;!--&lt;StackLayout Orientation="Horizontal" HorizontalOptions="FillAndExpand"&gt;
                      &lt;Button Text=" - " Style="{ DynamicResource SkuQtyStepper }" /&gt;
                      &lt;local:BorderedEntry Style="{ DynamicResource SkuQtyEntry }" Keyboard="Numeric" HeightRequest="20" /&gt;
                      &lt;Button Text=" + " Style="{ DynamicResource SkuQtyStepper }" /&gt;
                  &lt;/StackLayout&gt;--&gt;
                  &lt;local:AddToCartButton Text="Add to Cart" Style="{ DynamicResource SkuAddToCart }" Sku="{Binding Sku}" /&gt;
                  &lt;!--&lt;Button Text="Add to Cart" Style="{ DynamicResource SkuAddToCart }" /&gt;--&gt;
              &lt;/StackLayout&gt;
          &lt;/Grid&gt;
  
          &lt;Grid HeightRequest="1" Style="{ DynamicResource BackgroundMediumGray }" /&gt;
      &lt;/StackLayout&gt;
  &lt;/ContentView.Content&gt;
  </code></pre>
  
  <p></p>