title: Silverlight UserControl Binding
body: <p>I have a simple User Control</p>
  
  <p>Xaml:</p>
  
  <pre><code>&lt;UserControl x:Class="GraemeGorman_Controls.Navigation.NavigationItem"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"&gt;
      &lt;Border x:Name="borderLayoutRoot"&gt;
          &lt;TextBlock x:Name="textBlockCaption" Text="{Binding Caption}" /&gt;
      &lt;/Border&gt;
  &lt;/UserControl&gt;
  </code></pre>
  
  <p>Cs:</p>
  
  <pre><code>namespace GraemeGorman_Controls.Navigation
  {
      public partial class NavigationItem : UserControl
      {
          public static readonly DependencyProperty CaptionProperty = DependencyProperty.Register(
              "Caption",
              typeof (string),
              typeof (NavigationItem),
              new PropertyMetadata(new PropertyChangedCallback(OnCaptionChanged)));
  
          public string Caption
          {
              get {return (string)GetValue(CaptionProperty);}
              set {SetValue(CaptionProperty, value);}
          }
  
          public NavigationItem()
          {
              InitializeComponent();
          }
  
          private static void OnCaptionChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
          {
              //null
          }
      }
  }
  </code></pre>
  
  <p>What my issue is, when I create an instance of the control the caption never shows - now i have tested the property in the OnCaptionChanged function using e.NewValue and it is the correct value. What is wrong with my binding?</p>
  
  <p>If I write in the code behind caption property for set</p>
  
  <pre><code>textBlockCaption.Text = value;
  </code></pre>
  
  <p>It appears fine...</p>
  
  <p>Any help appreciated</p>
  
  <p>Thanks
  Graeme</p>