title: Getting "<Property Name> was already registered by "<Control Name>" error in WPF
body: <p>I have a user control in WPF that has a binding to a Dependency Property. When I try to compile the app, I get a "Property Name" was already registered by "ControlName" error, and the designer shows a "Cannot create an instance of "User Control" error.</p>
  
  <p>Here is what my simple control looks like:</p>
  
  <p><strong>ExampleUserControl.xaml:</strong></p>
  
  <pre><code>&lt;UserControl x:Class="ExampleApp1.ExampleUserControl"
               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" 
               xmlns:local="clr-namespace:ExampleApp1"
               mc:Ignorable="d" &gt;
  
      &lt;TextBox Text="{Binding RelativeSource={RelativeSource AncestorType={x:Type local:ExampleUserControl}}, Path=SomeStringValue}" /&gt;
  
  &lt;/UserControl&gt;
  </code></pre>
  
  <p><strong>ExampleUserControl.xaml.cs:</strong></p>
  
  <pre><code>public partial class ExampleUserControl : UserControl
  {
  
      public DependencyProperty SomeStringValueProperty = DependencyProperty.Register("SomeStringValue", typeof(string), typeof(ExampleUserControl));
      public string SomeStringValue
      {
          get
          {
              return GetValue(SomeStringValueProperty) as string;
          }
          set
          {
              SetValue(SomeStringValueProperty, value);
          }
      }
  
      public ExampleUserControl()
      {
          InitializeComponent();
      }
  }
  </code></pre>
  
  <p><strong>The Main Window it's hosted in:</strong></p>
  
  <pre><code>&lt;Window x:Class="ExampleApp1.MainWindow"
          xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
          xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
          xmlns:local="clr-namespace:ExampleApp1"
          Title="MainWindow" Height="350" Width="525"&gt;
  
      &lt;StackPanel&gt;
          &lt;local:ExampleUserControl SomeStringValue="Test 1" /&gt;
          &lt;local:ExampleUserControl SomeStringValue="Test 2" /&gt;
      &lt;/StackPanel&gt;
  
  &lt;/Window&gt;
  </code></pre>
  
  <p><strong>Here is what the designer looks like:</strong></p>
  
  <p><img src="https://i.stack.imgur.com/1Nxx9.png" alt="Screenshot of error in designer"></p>
  
  <p><strong>Here is what the XAML designer looks like:</strong>
  <img src="https://i.stack.imgur.com/32zrl.png" alt="XAML"></p>