title: WPF: Cannot set properties on property elements weirdness
body: <pre><code>private TextBlock _caption = new TextBlock();
  
  public TextBlock Caption  
  {  
      get { return _caption; }  
      set { _caption = value; }  
  }
  
  &lt;l:CustomPanel&gt;  
      &lt;l:CustomPanel.Caption Text="Caption text" FontSize="18" Foreground="White" /&gt;  
  &lt;/l:CustomPanel&gt;
  </code></pre>
  
  <p>Gives me the following error:<br />
  <b>Cannot set properties on property elements.</b></p>
  
  <p>If I use:</p>
  
  <pre><code>&lt;l:CustomPanel&gt;  
      &lt;l:CustomPanel.Caption&gt;
          &lt;TextBlock Text="Caption text" FontSize="18" Foreground="White" /&gt; 
      &lt;/l:CustomPanel.Caption&gt;
  &lt;/l:CustomPanel&gt;
  </code></pre>
  
  <p>My TextBlock shows up fine but it's nested inside another TextBlock like so, it even seems to add itself outside of the Caption property:<br /></p>
  
  <pre><code>&lt;l:CustomPanel&gt;  
      &lt;l:CustomPanel.Caption&gt;
          &lt;TextBlock&gt;
               &lt;InlineUIContainer&gt;
                   &lt;TextBlock Text="Caption text" FontSize="18" Foreground="White" /&gt; 
               &lt;/InlineUIContainer&gt;
          &lt;/TextBlock&gt;
      &lt;/l:CustomPanel.Caption&gt;
  
      &lt;TextBlock&gt;
           &lt;InlineUIContainer&gt;
               &lt;TextBlock Text="Caption text" FontSize="18" Foreground="White" /&gt; 
           &lt;/InlineUIContainer&gt;
      &lt;/TextBlock&gt;
  &lt;/l:CustomPanel&gt;
  </code></pre>
  
  <p>As you might have already guessed, what i'd like my code to do is to set my Caption property from XAML on a custom panel, if this is possible.</p>
  
  <p>I've also tried the same code with a DependencyProperty to no avail.</p>
  
  <p>So, anyone that can help me with this problem?</p>