Change font family of WPF window title c #

How do I change the font family of a window in WPF other than creating a template for the window and using it?

+3


source to share


1 answer


I usually use this in Application.Resources:

    <Style TargetType="{x:Type Window}">
        <Setter Property="FontFamily"
        Value="Cambria" />
    </Style>

      

And add this to the window constructor after InitializeComponent:

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

      

Pretty simple.

Or maybe use this in the same constructor after InitializeComponent:

 Application.Current.MainWindow.FontFamily = new FontFamily("Cambria");

      

Note: For the second approach, you no longer need this style.



See Windows font families here:

Edit 1

Unfortunately, I did not pay maximum attention to what you are asking. There is really no easy way to achieve this. I don't know what you have found or done so far, but I used this project and it behaved well.

Another example would be this. I haven't tried it but looks promising: Chrome WPF Custom Library

This requires a lot of work.

From MSDN:

The non-client window area is implemented by WPF and includes parts of the window that are common to most windows, including the following:

A border.

A title bar.

An icon.

Minimize, Maximize, and Restore buttons.

A Close button.

A System menu with menu items that allow users to minimize, maximize, restore, move, resize, and close a window.

      

And these "non-client" areas are controlled by windows.

+1


source







All Articles