title: Xamarin Forms - BindableProperty Not Working
body: <p>We have several BindableProperties in our system. They mostly work, and I haven't come across this problem before. I am testing on UWP, but the problem is probably the same on other platforms.</p>
  
  <p>You can see download this code here to see exactly what I am talking about
  <a href="https://ChristianFindlay@bitbucket.org/ChristianFindlay/xamarin-forms-scratch.git" rel="nofollow noreferrer">https://ChristianFindlay@bitbucket.org/ChristianFindlay/xamarin-forms-scratch.git</a></p>
  
  <p>Here is my code:</p>
  
  <pre><code>public class ExtendedEntry : Entry
  {
      public static readonly BindableProperty TestProperty =
        BindableProperty.Create&lt;ExtendedEntry, int&gt;
        (
        p =&gt; p.Test,
        0,
        BindingMode.TwoWay,
        propertyChanging: TestChanging
        );
  
      public int Test
      {
          get
          {
              return (int)GetValue(TestProperty);
          }
          set
          {
              SetValue(TestProperty, value);
          }
      }
  
      private static void TestChanging(BindableObject bindable, int oldValue, int newValue)
      {
          var ctrl = (ExtendedEntry)bindable;
          ctrl.Test = newValue;
      }
  }
  </code></pre>
  
  <p>This is the XAML:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt;
  &lt;ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
               xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
               xmlns:local="clr-namespace:TestXamarinForms"
               x:Class="TestXamarinForms.BindablePropertyPage"&gt;
      &lt;ContentPage.Content&gt;
          &lt;StackLayout&gt;
              &lt;local:ExtendedEntry Test="1" /&gt;
          &lt;/StackLayout&gt;
      &lt;/ContentPage.Content&gt;
  &lt;/ContentPage&gt;
  </code></pre>
  
  <p>I can see that in the setter for Test, 1 is being passed in to SetValue. But, on the next line, I look at GetValue for the property in the watch window, and the value 0. The BindableProperty is not sticking. I've tried instantiating the BindingProperty with a few different Create overloads, but nothing seems to work. What am I doing wrong?</p>