title: How to bind a Dependency Property to anything in the XAML
body: <p>(Using Silverlight 4.0 and VS 2010)<br>
  So I have created a property called <code>Rank</code> in my C# file. How do I now tie that to a control in the UserControl xaml file?</p>
  
  <p>My code: (TopicListItem.xaml.cs)</p>
  
  <pre><code>    #region Rank (DependencyProperty)
  
      /// &lt;summary&gt; 
      /// Rank 
      /// &lt;/summary&gt; 
      public int Rank
      {
          get { return (int)GetValue(RankProperty); }
          set { SetValue(RankProperty, value); }
      }
      public static readonly DependencyProperty RankProperty =
          DependencyProperty.Register("Rank", typeof(int), typeof(TopicListItem),
          new PropertyMetadata(0, new PropertyChangedCallback(OnRankChanged)));
  
      private static void OnRankChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
      {
          ((TopicListItem)d).OnRankChanged(e);
      }
  
      protected virtual void OnRankChanged(DependencyPropertyChangedEventArgs e)
      {
  
      }
  
      #endregion Rank (DependencyProperty)
  </code></pre>
  
  <p>I want to do this in my TopicListItem.xaml</p>
  
  <pre><code>...
  &lt;Textblock Text="{TemplateBinding Rank}"/&gt;
  ...
  </code></pre>
  
  <p>but that doesn't really work.</p>