title: UserControl Dependency Property design time
body: <p>I'm creating a simple User Control in WPF that contains a TextBlock inside a Button.</p>
  
  <pre><code>&lt;UserControl x:Class="WpfExpansion.MyButton"..... &gt;
      &lt;Grid &gt;
          &lt;Button Background="Transparent" &gt;
              &lt;TextBlock Text="{Binding Path=Text}"/&gt;
          &lt;/Button&gt;
      &lt;/Grid&gt;
  &lt;/UserControl&gt;
  </code></pre>
  
  <p>And also the "Text" dependency property.</p>
  
  <pre><code>public partial class MyButton : UserControl
  {
      public MyButton()
      {
          InitializeComponent();
          this.DataContext = this;         
      }
  
      public string Text
      {
          get { return (string)GetValue(TextProperty); }
          set { SetValue(TextProperty, value); }
      }
      public static readonly DependencyProperty TextProperty =
          DependencyProperty.Register("Text", typeof(string), typeof(MyButton), new PropertyMetadata(string.Empty));
  
  }
  </code></pre>
  
  <p>And then I use the UserControl like this:</p>
  
  <pre><code>&lt;MyButton Text="Test" /&gt;
  </code></pre>
  
  <p>The problem is that the Visual Studio design does not change, but it works in runtime.</p>
  
  <p>What is wrong?</p>
  
  <p>I also tried</p>
  
  <pre><code>DataContext="{Binding RelativeSource={RelativeSource Self}}"
  </code></pre>
  
  <p>Inside the UC definition, without success.</p>