title: Dependency Property Call in code behind
body: <p>I have created a custom UserControl with some Dependency properties.<br>
  This custom control is hosted on a Window.<br>
  When I try to get a value from a DependecyProperty in code behind it doesn't work.</p>
  
  <pre class="lang-cs prettyprint-override"><code>public static readonly DependencyProperty ValueDp = DependencyProperty.Register("Value", typeof(string), typeof(MyCustomUserControl), new FrameworkPropertyMetadata(string.Empty, OutputHandler));
  
  public string Value
  {
     get { return (string)GetValue(ValueDp); }
     set { SetValue(ValueDp, value); }
  }
  
  private static void OutputHandler(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs dependencyPropertyChangedEventArgs)
  {
     var temp= dependencyObject as MyCustomUserControl;
     if (temp!= null)
     {
        dependencyObject.SetValue(ValueDp,temp._conversionValue);
     }
  }
  </code></pre>
  
  <p>On the host I have put a button and when I click on it, I want to read the value stored in the DP, but I will always get the default value set in DP. </p>
  
  <p>Any ideas what I`m doing wrong here?</p>
  
  <p>Regards</p>