FontWeights Class

Definition

Provides a set of predefined font weights as static property values.

Equivalent WinUI class: Microsoft.UI.Text.FontWeights.

public ref class FontWeights sealed
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class FontWeights final
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public sealed class FontWeights
Public NotInheritable Class FontWeights
See XAML Syntax for FontWeight
Inheritance
Object IInspectable FontWeights
Attributes

Windows requirements

Device family
Windows 10 (introduced in 10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced in v1.0)

Examples

This example shows how to set the FontWeight property on a XAML TextBlock.

<TextBlock Text="FontWeight ExtraBlack" FontWeight="ExtraBlack"/>
TextBlock textBlock1 = new TextBlock();
textBlock1.Text = "FontWeight ExtraBlack";
textBlock1.FontWeight = Windows.UI.Text.FontWeights.ExtraBlack;

Remarks

In standard typography API, the weight of a font is expressed by using constant names, for example "Bold". Using constant names for setting a font weight property is supported through type converter behaviors and also by the FontWeights support class. For code access, the relevant information is expressed as the Weight factor of a FontWeight value.

This image shows the various font weight values applied to text.

Various font weight values applied to text

Properties

Black

Specifies a font weight value of 900.

Equivalent WinUI property: Microsoft.UI.Text.FontWeights.Black.

Bold

Specifies a font weight value of 700.

Equivalent WinUI property: Microsoft.UI.Text.FontWeights.Bold.

ExtraBlack

Specifies a font weight value of 950.

Equivalent WinUI property: Microsoft.UI.Text.FontWeights.ExtraBlack.

ExtraBold

Specifies a font weight value of 800.

Equivalent WinUI property: Microsoft.UI.Text.FontWeights.ExtraBold.

ExtraLight

Specifies a font weight value of 200.

Equivalent WinUI property: Microsoft.UI.Text.FontWeights.ExtraLight.

Light

Specifies a font weight value of 300.

Equivalent WinUI property: Microsoft.UI.Text.FontWeights.Light.

Medium

Specifies a font weight value of 500.

Equivalent WinUI property: Microsoft.UI.Text.FontWeights.Medium.

Normal

Specifies a font weight value of 400.

Equivalent WinUI property: Microsoft.UI.Text.FontWeights.Normal.

SemiBold

Specifies a font weight value of 600.

Equivalent WinUI property: Microsoft.UI.Text.FontWeights.SemiBold.

SemiLight

Specifies a font weight value of 350.

Equivalent WinUI property: Microsoft.UI.Text.FontWeights.SemiLight.

Thin

Specifies a font weight value of 100.

Equivalent WinUI property: Microsoft.UI.Text.FontWeights.Thin.

Applies to