title: Silverlight: Invalid Attribute Type for TargetType="{x:Type TextBlock}"
body: <p>Just playing around with Silverlight a bit and trying to set a style to apply to all TextBlocks. The following XAML:</p>
  
  <pre><code>&lt;Style TargetType="{x:Type TextBlock}"&gt;
     &lt;Setter Property="Margin" Value="10, 10, 10, 10" /&gt;
  &lt;/Style&gt;
  </code></pre>
  
  <p>Gives me the error <code>Invalid attribute value {x:Type TextBlock} for property TargetType.</code></p>
  
  <p>I copied and pasted this bit from the MSDN so I'm a little lost as to why I'm getting this error.</p>
  
  <p>EDIT:</p>
  
  <p>Here's the full code I'm attempting now:</p>
  
  <pre><code>&lt;UserControl x:Class="NIRC.Page"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
      Width="400" Height="300"&gt;
      &lt;UserControl.Resources&gt;
          &lt;Style TargetType="TextBlock"&gt;
              &lt;Setter Property="Margin" Value="10" /&gt;
              &lt;Setter Property="Foreground" Value="Red" /&gt;
          &lt;/Style&gt;
      &lt;/UserControl.Resources&gt;
      &lt;TextBlock&gt;Hello World!&lt;/TextBlock&gt;
  &lt;/UserControl&gt;
  </code></pre>
  
  <p>Here's how it looks:</p>
  
  <p><a href="http://www.netortech.com/Content/slhw.jpg">alt text http://www.netortech.com/Content/slhw.jpg</a></p>