title: What is the correct way to create exposed properties with defaults in WPF?
body: <p>I am making a user control with a default value for one of its properties. Here is how I am currently doing it.</p>
  
  <pre><code>&lt;UserControl x:Class="Example.HelloWorld"
               xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
               xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
               xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
               xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
               mc:Ignorable="d" 
               d:DesignHeight="300" d:DesignWidth="300"
               x:Name="This"&gt;
      &lt;Grid&gt;
              &lt;TextBlock Text="{Binding ElementName=This, Path=TextToDisplay}"/&gt;
      &lt;/Grid&gt;
  &lt;/UserControl&gt;
  </code></pre>
  
  
  
  <pre><code>using System.Windows;
  using System.Windows.Controls;
  
  namespace Example
  {
      /// &lt;summary&gt;
      /// Interaction logic for HelloWorld.xaml
      /// &lt;/summary&gt;
      public partial class HelloWorld : UserControl
      {
  
  
          public HelloWorld()
          {
              InitializeComponent();
          }
  
          public static readonly DependencyProperty TextToDisplayProperty = DependencyProperty.Register("TextToDisplay", typeof(string),
              typeof(HelloWorld), new PropertyMetadata("Hello World!"));
  
          public string TextToDisplay
          {
              get { return (string)GetValue(TextToDisplayProperty); }
              set { SetValue(TextToDisplayProperty, value); }
          }
      }
  }
  </code></pre>
  
  <p>The problem is when looking at the preview window it does not show my default value.</p>
  
  <p><img src="https://i.stack.imgur.com/iEhiF.png" alt="enter image description here"></p>
  
  <p>But If I put my control in something else the default text does show up.</p>
  
  <p><img src="https://i.stack.imgur.com/LBRIR.png" alt="enter image description here"></p>
  
  <p>The fact that it does not show up in the designer when I am on the <code>UserControl</code> makes me concerned that I am not doing it the correct way. Am I exposing properties to the user correctly or, if not, what is the correct way to expose a property that the user of the control can override?</p>