title: Is there something wrong with my dependency property? Content not set with binding
body: <p>I wonder if theres something wrong with my dependency property?</p>
  <pre><code>// In MarkdownEditor.xaml.cs, DataContext for MarkdownEditor.xaml
  public string TextContent
  {
      get { return (string)GetValue(TextContentProperty); }
      set { SetValue(TextContentProperty, value); }
  }
  
  public static readonly DependencyProperty TextContentProperty =
      DependencyProperty.Register(&quot;TextContent&quot;, typeof(string), typeof(MarkdownEditor), new UIPropertyMetadata(&quot;&quot;));
  </code></pre>
  <p>When <code>TextContent</code> is set in XAML like</p>
  <pre><code>&lt;me:MarkdownEditor TextContent=&quot;{Binding TextContent}&quot; Options=&quot;{Binding Options}&quot; /&gt;
  </code></pre>
  <p>It fails ... when I do</p>
  <pre><code>&lt;me:MarkdownEditor TextContent=&quot;Hello world&quot; Options=&quot;{Binding Options}&quot; /&gt;
  </code></pre>
  <p>It works ... Is there something wrong? A similar thing seems to be happening to options</p>
  <br />
  <h1>UPDATE 1</h1>
  <p>I notice that the binding with a normal text box works fine</p>
  <pre><code>&lt;TextBox Text=&quot;{Binding TextContent}&quot; /&gt;
  </code></pre>
  <p><strong>FYI: In <code>MarkdownEditor.xaml</code></strong></p>
  <pre><code>&lt;TextBox Text=&quot;{Binding TextContent}&quot; 
          FontFamily=&quot;{Binding Path=Options.FontFamily}&quot;
          FontSize=&quot;{Binding Path=Options.FontSize}&quot;
          FontWeight=&quot;{Binding Path=Options.FontWeight}&quot;
          Background=&quot;{Binding Path=Options.Background}&quot;
          Foreground=&quot;{Binding Path=Options.Foreground}&quot; /&gt;
  </code></pre>
  <h1>UPDATE 2</h1>
  <p>Oh! I wonder if when I do</p>
  <pre><code>&lt;me:MarkdownEditor TextContent=&quot;{Binding TextContent}&quot; Options=&quot;{Binding Options}&quot; /&gt;
  </code></pre>
  <p>Where does the properties <code>TextContent</code> &amp; <code>Options</code> come from? <code>MarkdownEditor</code>'s ViewModel?</p>
  <h1>UPDATE 3</h1>
  <p>Another few observations:</p>
  <p><strong>Barebones</strong></p>
  <pre><code>&lt;me:MarkdownEditor /&gt;
  </code></pre>
  <p><code>TextContent</code> will be set to the value from <code>MarkdownEditor</code>'s constructor</p>
  <pre><code>public MarkdownEditor()
  {
      InitializeComponent();
      DataContext = this;
      TextContent = &quot;From MarkdownEditor.xaml.cs&quot;;
  }
  </code></pre>
  <p><strong>Static Value</strong></p>
  <pre><code>&lt;me:MarkdownEditor TextContent=&quot;Static Value&quot; /&gt;
  </code></pre>
  <p>The string &quot;Static Value&quot; is shown</p>
  <p><strong>Binding</strong></p>
  <pre><code>&lt;me:MarkdownEditor TextContent=&quot;{Binding Path=TextContent}&quot; /&gt;
  </code></pre>
  <p>value from Dependency Property declaration is shown</p>
  <pre><code>public static readonly DependencyProperty TextContentProperty =
          DependencyProperty.Register(..., new UIPropertyMetadata(&quot;Default&quot;));
  </code></pre>