title: Passing an object to a Behaviour in XAML is not working
body: <p>I have a list of Settings that are a mix of types (int and string, url, ip address etc.) and the parameters that allow these to be validated are stored alongside the actual value in an object. This object is selected from a list of settings and passed to a detail page where the value can be modified.</p>
  
  <p>On the detail page, I have an Entry control that contains the value that requires validation. The Entry takes it's inital value from the ViewModel property SettingItem. This works fine.</p>
  
  <p>I have a Behaviour that i'm going to use to validate the user input to the value on-the-fly however, when the HandleTextChanged method is fired, ItemToValidate is null. I can't work out why.</p>
  
  <p>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"
           x:Class="DwyApp.Views.ItemDetailPage"
           xmlns:local="clr-namespace:DwyApp.Behaviours"
           Title="{Binding Title}"&gt;
  &lt;StackLayout Spacing="20" Padding="15"&gt;
      &lt;Label Text="{Binding SettingItem.ParameterName}" FontSize="Medium" FontAttributes="Bold"/&gt;
      &lt;Entry Text="{Binding SettingItem.Value}" FontSize="Medium"&gt;
          &lt;Entry.Behaviors&gt;
              &lt;local:ValidateBehaviour ItemToValidate="{Binding SettingItem}" /&gt;
          &lt;/Entry.Behaviors&gt;
      &lt;/Entry&gt;
      &lt;Label x:Name="Value_Error" Text="{Binding SettingItem.ValidationMessage}" FontSize="Medium" IsVisible="{Binding SettingItem.ValidateValue}" TextColor="Red" /&gt;
      &lt;Button Text="Save"
              VerticalOptions="Center"
              HorizontalOptions="Center"/&gt;
      &lt;Label Text="{Binding SettingItem.Description}" FontSize="Medium"/&gt;
  &lt;/StackLayout&gt;
  </code></pre>
  
  <p></p>
  
  <p>Behaviour:</p>
  
  <pre><code>using DwyApp.Models;
  using System;
  using System.Collections.Generic;
  using System.Diagnostics;
  using System.Text;
  using Xamarin.Forms;
  
  namespace DwyApp.Behaviours
  {
  public class ValidateBehaviour:Behavior&lt;Entry&gt;
  
  {
  
      public static readonly BindableProperty ItemToValidateProperty = BindableProperty.Create(nameof(ItemToValidate), 
                                                                                              typeof(SettingItem), 
                                                                                              typeof(ValidateBehaviour), 
                                                                                              defaultValue: null);
  
      public SettingItem ItemToValidate
      {
          get {
              return (SettingItem)GetValue(ItemToValidateProperty);
          }
          set {
              SetValue(ItemToValidateProperty, value);
          }
      }
  
  
      protected override void OnAttachedTo(Entry bindable)
      {
          bindable.TextChanged += HandleTextChanged;
          base.OnAttachedTo(bindable);
      }
  
      void HandleTextChanged(object sender, TextChangedEventArgs e)
      {
          bool IsValid = false;
      }
  
      protected override void OnDetachingFrom(Entry bindable)
      {
          bindable.TextChanged -= HandleTextChanged;
          base.OnDetachingFrom(bindable);
      }
  
  }
  </code></pre>
  
  <p>}</p>
  
  <p>A breakpoint at HandleTextChanged is always hit but the value of ItemToValidate is always null. Any ideas?</p>