title: How do the default color, font family and font size for a TextBlock and Label get set in an WPF app?
body: <p>Edit: I guess the question wasn't stated very clearly. It actually composes of 4 separate ones:</p>
  
  <ol>
  <li>How does a <code>TextBlock</code> get its default color, if the client app doesn't provide any style, either programmatically or through xaml?  </li>
  <li>How does a <code>Label</code> get its default color?</li>
  <li>How does a <code>TextBlock</code> get its default font size and font family, if the client app doesn't provide any style, either programmatically or through xaml?</li>
  <li>How does a <code>Label</code> get its default font size and font family?</li>
  </ol>
  
  <p>BTW, the questions are not about how to <em>change</em> or define styles for the color/font size/font family of a <code>TextBlock</code> or a <code>Label</code>, although they are somehow related. I think I already knew the answer for #2, that is a <code>Label</code> gets its color from <a href="http://msdn.microsoft.com/en-us/library/system.windows.systemcolors.controltextbrushkey.aspx" rel="noreferrer">SystemColors.ControlTextBrushKey</a> and by overriding <code>ConrolTextBrushKey</code> like so:</p>
  
  <pre><code>&lt;SolidColorBrush x:Key="{x:Static SystemColors.ControlTextBrushKey}" Color="Red"/&gt;
  </code></pre>
  
  <p>You would be able to "globally" change color for <code>Label</code>s. After some research, I guess I also find the answer for #1: A <code>TextBlock</code> inherits the its foreground color from its containing <code>Window</code>, which by default gets its <code>Foreground</code> color from <a href="http://msdn.microsoft.com/en-us/library/system.windows.systemcolors.windowtextbrushkey.aspx" rel="noreferrer">SystemColors.WindowTextBrushKey</a>. By defining a color for the WindowTextBrush like so:  </p>
  
  <pre><code>&lt;Window.Resources&gt;
      &lt;SolidColorBrush x:Key="{x:Static SystemColors.WindowTextBrushKey}" 
                       Color="Yellow"/&gt;
  &lt;/Window.Resources&gt;
  </code></pre>
  
  <p>You would be able to change the "foreground" color for the <code>TextBlock</code>s inside the <code>Window</code>. </p>
  
  <p>Question #3 and #4 remain puzzles for me, but I am assuming they have to do with the <a href="http://msdn.microsoft.com/en-us/library/system.windows.systemfonts.aspx" rel="noreferrer">SystemFonts</a>.</p>
  
  <p>Hope this makes sense. I really like to know the answers as they have been bothering me for a while. Many thanks!</p>
  
  <p>Below is the original post:</p>
  
  <hr>
  
  <p>If you look into the style for a <code>Label</code> in the theme (for example "aero.normalcolor.xaml") that comes with Windows, you can find </p>
  
  <pre><code>&lt;Setter Property="Foreground" 
          Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/&gt;
  </code></pre>
  
  <p>Which sets the color for a <code>Label</code>. But there is no where the <code>FontSize</code> property is specified in the style, which I assume has something to do with the <a href="http://msdn.microsoft.com/en-us/library/system.windows.systemfonts.aspx" rel="noreferrer">SystemFonts</a>. For a <code>TextBlock</code>, it looks even more mysterious as the style for it in "aero.normalcolor.xaml" has only 4 lines:</p>
  
  <pre><code>&lt;Style x:Key="{x:Type TextBlock}"
                   TargetType="{x:Type TextBlock}"&gt;
          &lt;Setter Property="TextWrapping"
                          Value="NoWrap"/&gt;
          &lt;Setter Property="TextTrimming"
                          Value="None"/&gt;
      &lt;/Style&gt;
  </code></pre>
  
  <p>Where does a <code>Label</code> or a <code>TextBlock</code> get the values for its color and font size/family from, if the app doesn't set any, and where are those hooks in WPF? </p>
  
  <p>Edit:</p>
  
  <p>This is a test drive attempting to set the <code>TextBlock</code> color through <code>SystemColors.ControlTextBrush</code> (assuming that's where a <code>TextBlock</code> gets its default color from, which seems to be false):</p>
  
  <pre><code>&lt;Window x:Class="TestFontColor.MainWindow"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      Title="MainWindow" Height="350" Width="525"&gt;
  &lt;StackPanel&gt;
      &lt;StackPanel.Resources&gt;
          &lt;SolidColorBrush x:Key="{x:Static SystemColors.ControlTextBrushKey}" Color="Red"/&gt;
      &lt;/StackPanel.Resources&gt;
      &lt;Button Content="This is red."/&gt;
      &lt;Label Content="This is blue."&gt;
          &lt;Label.Resources&gt;
              &lt;SolidColorBrush x:Key="{x:Static SystemColors.ControlTextBrushKey}" Color="Blue"/&gt;
          &lt;/Label.Resources&gt;
      &lt;/Label&gt;
      &lt;TextBlock Text="TextBlock: This is still black."/&gt;
  &lt;/StackPanel&gt;
  </code></pre>
  
  <p></p>