title: Unable to set some properties when using custom WPF Control
body: <p>So, I've got a custom WPF control called WatermarkTextbox which extends TextBox.  The only thing I added to the code is a string dependency property to hold the watermark text.  The rest of the magic is in the Xaml (below).  </p>
  
  <pre><code>&lt;Style TargetType="wpfControls:WatermarkTextbox" &gt;
      &lt;Setter Property="Template"&gt;
          &lt;Setter.Value&gt;
              &lt;ControlTemplate TargetType="{x:Type wpfControls:WatermarkTextbox}"&gt;
                  &lt;Grid&gt;
                      &lt;TextBox x:Name="baseTextBox" /&gt;
                      &lt;TextBlock Margin="5,0,0,0" x:Name="watermarkText" IsHitTestVisible="False" FontWeight="Light" FontStyle="Italic" Foreground="DarkGray" Visibility="Hidden" Background="Transparent"
                                 Text="{Binding RelativeSource={RelativeSource AncestorType=wpfControls:WatermarkTextbox}, Path=Watermark}" /&gt;
                  &lt;/Grid&gt;
                  &lt;ControlTemplate.Triggers&gt;
                      &lt;Trigger SourceName="baseTextBox" Property="Text" Value=""&gt;
                          &lt;Setter TargetName="watermarkText" Property="Visibility" Value="Visible"/&gt;
                      &lt;/Trigger&gt;
                  &lt;/ControlTemplate.Triggers&gt;
              &lt;/ControlTemplate&gt;
          &lt;/Setter.Value&gt;
      &lt;/Setter&gt;
  &lt;/Style&gt;
  </code></pre>
  
  <p>and when used in my application:</p>
  
  <pre><code>&lt;wpfControls:WatermarkTextbox Watermark="Text that disappears."/&gt;
  </code></pre>
  
  <p>This works, mostly.  I can set the watermark text, and when I start entering some text, it goes away.  When I change the font size, it changes both the watermark and the text I enter; when I change the font weight, it only changes the text entered (which is what I want it to do).  I can change the size of the textbox.  That's all gravy.</p>
  
  <p>The problem is when I start trying to change things like the textbox's background or border properties, like so.</p>
  
  <pre><code>&lt;wpfControls:WatermarkTextbox Watermark="Text that disappears." Background="Yellow"/&gt;
  </code></pre>
  
  <p>Nothing happens.  Same behavior with BorderBrush and BorderThickness.  Now, the part where I know just enough to know that there's some important concept that I don't know.  If I change the template for my WatermarkTextbox to the following, it will let me set the background in my application like I want.</p>
  
  <pre><code>&lt;Style TargetType="wpfControls:WatermarkTextbox" &gt;
      &lt;Setter Property="Template"&gt;
          &lt;Setter.Value&gt;
              &lt;ControlTemplate TargetType="{x:Type wpfControls:WatermarkTextbox}"&gt;
                  &lt;Grid&gt;
                      &lt;TextBox x:Name="baseTextBox" 
                               Background="{TemplateBinding Background}"/&gt;
                      &lt;TextBlock Margin="5,0,0,0" x:Name="watermarkText" IsHitTestVisible="False" FontWeight="Light" FontStyle="Italic" Foreground="DarkGray"
                                 Text="{Binding RelativeSource={RelativeSource AncestorType=wpfControls:WatermarkTextbox}, Path=Watermark}" Visibility="Hidden" Background="Transparent"/&gt;
                  &lt;/Grid&gt;
                  &lt;ControlTemplate.Triggers&gt;
                      &lt;Trigger SourceName="baseTextBox" Property="Text" Value=""&gt;
                          &lt;Setter TargetName="watermarkText" Property="Visibility" Value="Visible"/&gt;
                      &lt;/Trigger&gt;
                  &lt;/ControlTemplate.Triggers&gt;
              &lt;/ControlTemplate&gt;
          &lt;/Setter.Value&gt;
      &lt;/Setter&gt;
  &lt;/Style&gt;
  </code></pre>
  
  <p>I assume that if I did the same for BorderBrush and BorderThickness, they would work as well.</p>
  
  <p>So, my question is, why?  What is it about these properties that makes them behave differently from FontSize and FontWeight or Height and Width?  Why do I have to explicitly set the Background to {TemplateBinding Background} but not FontSize?  Also, what other properties do I need to set to the TemplateBinding in order to make them work properly?</p>