title: WPF Custom control dependency property: cannot be string type?
body: <p>I'm trying to add a <code>DependencyProperty</code> to a WPF custom control.</p>
  
  <p>Everything is fine until I keep the code generate by the snippet propdp:</p>
  
  <pre><code>namespace CustomControl
  {
  
      public partial class MainControl
      {
          public string MyProperty
          {
              get { return (string)GetValue(MyPropertyProperty); }
              set { SetValue(MyPropertyProperty, value); }
          }
  
          // Using a DependencyProperty as the backing store for MyProperty.  This enables animation, styling, binding, etc...
          public static readonly DependencyProperty MyPropertyProperty =
              DependencyProperty.Register("MyProperty", typeof(string), typeof(MainControl), new UIPropertyMetadata(0));
  
          public MainControl()
          {
              this.InitializeComponent();
          }
      }
  }
  </code></pre>
  
  <p>But as soon as I change the type from "int" to "string", I got a runtime error which tells
  "Impossible to create an instance of MainControl defined in assembly CustomControl etc....</p>
  
  <p>Then I change back to type "int" and everything run again properly.</p>
  
  <p>Does somebody have a clue to fix this mystery?</p>