How is the default font size for a wpf window determined?

后端 未结 1 1724
野性不改
野性不改 2021-01-23 13:55

I understand that in WPF the font size used by a control is determined by the parent control, unless an override is defined.

Given that I don\'t define a font-size anywh

相关标签:
1条回答
  • 2021-01-23 14:38

    The default font size is determined by the FontSize dependency property of the TextElement class: https://referencesource.microsoft.com/#PresentationFramework/src/Framework/System/Windows/Documents/TextElement.cs,e28640b48d79de57. It defaults to SystemFonts.MessageFontSize which has a default value of 12.

    The Control base class them adds itself as an owner of this dependency property and defines its own FontSize property that can any control can set to a custom value.

    Please refer to the following blog post for more information about this: https://blog.davidpadbury.com/2008/08/30/change-the-default-font-of-a-wpf-application/.

    0 讨论(0)
提交回复
热议问题