title: WPF TextBox: error setting style
body: <p>I have defined style for my textboxes that would show hints about what to enter when the textbox is empty.</p>
  
  <p>This would be my window:</p>
  
  <pre><code>&lt;Grid&gt;
      &lt;Grid.Resources&gt;
          &lt;Style TargetType="{x:Type TextBox}" x:Key="stlHintbox"&gt;
              &lt;Style.Triggers&gt;
                  &lt;DataTrigger Binding="{Binding Text, RelativeSource={RelativeSource Mode=Self}}" Value=""&gt;
                      &lt;Setter Property="Background"&gt;
                          &lt;Setter.Value&gt;
                              &lt;VisualBrush Stretch="None"&gt;
                                  &lt;VisualBrush.Visual&gt;
                                      &lt;TextBlock Text="First name" FontStyle="Italic" Foreground="LightGray" /&gt;
                                  &lt;/VisualBrush.Visual&gt;
                              &lt;/VisualBrush&gt;
                          &lt;/Setter.Value&gt;
                      &lt;/Setter&gt;
                  &lt;/DataTrigger&gt;
              &lt;/Style.Triggers&gt;
          &lt;/Style&gt;
      &lt;/Grid.Resources&gt;
      &lt;TextBox Style="stlHintbox" /&gt;
  &lt;/Grid&gt;
  </code></pre>
  
  <p>And the error thrown is:</p>
  
  <p><code>'Set property 'System.Windows.FrameworkElement.Style' threw an exception.' Line number '22' and line position '11'.</code></p>
  
  <p>with inner exception of: </p>
  
  <p><code>"'stlHintbox' is not a valid value for property 'Style'."</code></p>
  
  <p>The style is working OK when placed inside <code>&lt;TextBox.Style&gt;</code>, so what am I doing wrong here?</p>