title: How to set a control resource dictionary in a Style in XAML?
body: <p>I have a UI in Silverlight with some borders, and with a TextBlock inside that borders. There will be other TextBlocks outside borders. </p>
  
  <pre><code>&lt;Border&gt;
      &lt;TextBlock&gt;This text should be centered&lt;/TextBlock&gt;
  &lt;/Border&gt;
  
  &lt;Border&gt;
      &lt;TextBlock&gt;This one too&lt;/TextBlock&gt;
  &lt;/Border&gt;
  
  &lt;TextBlock&gt;this one shouldn't&lt;/TextBlock&gt;
  </code></pre>
  
  <p>What I'm trying to achieve is to format all TextBlock's inside a Border, without having to set the style in every TextBlock. If it was CSS , it will be something like that : <code>.border .textBlock { (...) }</code></p>
  
  <p>I know i can set a style inside the scope of a border: </p>
  
  <pre><code>&lt;Border&gt;
      &lt;Border.Resources&gt;
          &lt;Style TargetType="TextBlock" BasedOn="{StaticResource DefaultTextBlockStyle}"&gt;
              &lt;Setter Property="HorizontalAlignment" Value="Center"&gt;&lt;/Setter&gt;    
          &lt;/Style&gt;
      &lt;/Border.Resources&gt;
      &lt;TextBlock&gt;Centered Text&lt;/TextBlock&gt;
  &lt;/Border&gt;
  </code></pre>
  
  <p>But I would still need to set this to every border in my page. So now i presente the question, can i set  in a style, in order to set it one time to affect all Borders? I tried the code bellow, but it didn't work. It didn't give me any errors, but it didn't affect the TextBlock formatting either.</p>
  
  <pre><code>&lt;Style TargetType="Border"&gt;
      &lt;Setter Property="Resources"&gt;
          &lt;Setter.Value&gt;
              &lt;ResourceDictionary&gt;
                  &lt;Style TargetType="TextBlock"&gt;
                      &lt;Setter Property="HorizontalAlignment" Value="Center" /&gt;  
                  &lt;/Style&gt;
              &lt;/ResourceDictionary&gt;
          &lt;/Setter.Value&gt;
      &lt;/Setter&gt;
  &lt;/Style&gt;     
  </code></pre>