开发者

How do I change the Typography defaults in WPF?

When a WPF applications starts, it has some standard settings that are applied to determine how text and numbers will look. Is there any way for me to change these default settings programatically?

For instance, the FontNumeralAlignment documentation on MSDN states that a value of "Normal" means that "Default numeral alignment is used". On my system this seems to default to FontNumeralAlignment.Proportional, I would like it to instead be FontNumeralAlignment.Tabular.

Background: WPF 4.0 OpenType support is broken on Windows 7 (see bug report on Microsoft Connect) and it is impossible to change numeral alignment on runs containing only numbers and punctuation. If I could at least change the application defaults to tabular, lining figures I would have a workar开发者_开发知识库ound.


I haven't tried it myself yet, but maybe overriding the default DependencyProperty metadata would be a solution?

Something like this should work:

public static class Overrides 
{
   static Overrides()
   {
       Typography.NumeralAlignmentProperty.OverrideMetadata(typeof(Typography), new System.Windows.PropertyMetadata(FontNumeralAlignment.Tabular));
   }
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜