WPF global font size

前端 未结 10 721
别跟我提以往
别跟我提以往 2020-12-02 08:43

I\'m creating a WPF app and I would like to know the best way to be able to change the font size for every element in the ui. Do I create a resource dictionary and set Style

10条回答
  •  感情败类
    2020-12-02 08:52

    FontSizeProperty is inherited from Parent Control. So you just need to change FontSize of your main window.

    If you don't need dynamic behaviour this should work:

    Add a style for Window to your ResourceDictionary

    
    

    Apply the style to your main form (will not be applied implicit because its a derived type)

     Style = (Style)FindResource(typeof (Window));
    

提交回复
热议问题