How to override system default styles in WPF

You should typically use system defined styles for your controls, such as:

<Label FontFamily="{x:Static SystemFonts.MessageFontFamilyKey}" Content="Hello World"/>

or:

  <StackPanel TextBlock.FontSize="{x:Static SystemFonts.MessageFontSize}"
              TextBlock.FontFamily="{x:Static SystemFonts.MessageFontFamily}">
        <Label Content="Hello World" />
  </StackPanel>

When using a static resource binding like this, you're basically giving up the ability to override the styles set by the current OS theme. This may be a good thing in many situations, to have a standard look & feel. ...

Read full article

No Comments