WPF global font size

前端 未结 10 706
别跟我提以往
别跟我提以往 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 09:03

    For any styles in WPF, you should have a separate resource dictionary that contains the styles for your app.

    If you want to have a single Font Size that's reused throughout the app then just create a style for that font size. You can either give it a unique name/key to use explicitly or you can set a targetType that will transcend throughout the app.

    Explicit Key:

    
    
    
    

    *Note this style can be used with controls that have contentPresenters

    For all textblocks in the app:

    
    
    
    

提交回复
热议问题