title: windows phone 7 silverlight user control: data binding not working on custom property
body: <p>I have a rather simple user control (RatingControl) that has a dependency property defined as follows:</p>
  
  <pre><code>    public partial class RatingControl : UserControl
  {
      public RatingControl()
      {
          InitializeComponent();
      }
  
      public static readonly DependencyProperty RatingValueProperty = DependencyProperty.Register("RatingValue", typeof(double), typeof(RatingControl), new PropertyMetadata(0.0));
  
      public double RatingValue
      {
          set 
          { 
              double normalizeValue = 0.0;
  
              if (value &gt; 10.0)
              {
                  normalizeValue = 10.0;
              }
              else if (value &gt; 0.0)
              {
                  normalizeValue = value;
              }
  
              SetValue(RatingValueProperty, normalizeValue);
              RenderRatingValue();
          }
          get { return (double)GetValue(RatingValueProperty); }
      }
  </code></pre>
  
  <p>...</p>
  
  <p>This control receives properly the RatingValue if I assign it directly:</p>
  
  <pre><code>&lt;gtcontrols:RatingControl RatingValue="2.0" /&gt;
  </code></pre>
  
  <p>However, if I try to assign it with data binding, it does not work. The "set" code for RatingValue is never called, nor I see data binding errors in the debug output window.
  Note below that I tried to assign the same value to a standard property (Width), and in that case the value is properly passed to it.</p>
  
  <pre><code>&lt;StackPanel&gt;
                  &lt;TextBox Name="Test" Text="200.0" /&gt;
  
                  &lt;gtcontrols:RatingControl Width="{Binding ElementName=Test, Path=Text}" RatingValue="{Binding ElementName=Test, Path=Text}" /&gt;
                  &lt;TextBlock Text="{Binding ElementName=Test, Path=Text}" /&gt;
              &lt;/StackPanel&gt;
  </code></pre>
  
  <p>Not only the TextBlock receives the value correctly. also RatingControl receives is for the width, properly set at 200 pixels; however, the RatingValue is not set (method set not even called)</p>
  
  <p>What am I missing?
  Thanks in advance.</p>