Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6109201
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T14:22:42+00:00 2026-05-23T14:22:42+00:00

Possible Duplicate: How to set the default font for a wpf application? Coming from

  • 0

Possible Duplicate:
How to set the default font for a wpf application?

Coming from a web development background I often get mixed up on how to assign styles to my controls. What I’d like to do is set a global font family for the entire application.

In my App.xaml file I have the following

    <Style TargetType="{x:Type Window}">
        <Setter Property="FontFamily" Value="Helvetica, Arial" />
        <Setter Property="FontSize" Value="13" />
    </Style>

I’ve tried changing the target type to Control but that’s not doing anything. I would expect that since everything technically lives in a Window control that everything would work as expected.

Turns out the TextBlock control doesn’t inherit from Control. I’m assuming that’s most of the problem because 90% of my text is in TextBlock form.

In CSS I would do something like this:

body {
    font-family: Helvetica, Arial;
    font-size: 13px;
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T14:22:42+00:00Added an answer on May 23, 2026 at 2:22 pm

    What I have previously done is create a Style for Control, then derive other control styles from it. For whatever reason, WPF doesn’t want to take a FontFamily setting directly from a Control style, but if it takes it from a Button Style that is based on Control, then it works. If I get some time later on, I will dig around and find a previous implementation of this.

    Edit:
    Couldn’t remember where I might have put a ready made example, so I made one:

    <Style x:Key="ControlStyle" TargetType="Control">
        <Setter Property="FontFamily" Value="Wingdings"/>
    </Style>
    <Style TargetType="Button" BasedOn="{StaticResource ControlStyle}"/>
    

    Also, keep in mind, a style for TextBlock cannot be based on Control. Textblock derives from Framework element, not Control. Label, checkbox, Textbox, etc derive from Control which derives from Framework Element.

    You will likely have to have a separate style for Textblock. One thing you can do is set a font family resource and bind your top level styles to that. Then if it changes, all you have to do is change that one instance.

    <FontFamily x:Key="DefaultFont" >Ravie</FontFamily>
    
    <Setter Property="FontFamily" Value="{DynamicResource DefaultFont}"/>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: How can I pre-set arguments in JavaScript function call? (Partial Function Application)
Possible Duplicate: How do I programmatically set the background color gradient on a Custom
Possible Duplicate: How do you set a default value for a MySQL Datetime column?
Possible Duplicate: Default class inheritance access I know I can set the protection level
Possible Duplicate: How can I set the umask from within java? How do you
Possible Duplicates: How to set default font for all the windows in a Win32
Possible Duplicate: Cannot set boolean values in LocalStorage? So i've been trying to get
Possible Duplicate: How to set ringtone in Android from my activity? What I want
Possible Duplicate: Is there anyway to set values in the settings.bundle from within the
Possible Duplicate: How to get/set logical directory path in python I have a Python

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.