Control.FontStretch Property

Definition

Gets or sets the degree to which a font is condensed or expanded on the screen.

[System.ComponentModel.Bindable(true)]
public System.Windows.FontStretch FontStretch { get; set; }

Property Value

A FontStretch value. The default is Normal.

Attributes

Examples

The following example shows how to set the font stretch property of a control. For possible stretch values, see FontStretches.

<Button Name="btn10" FontStretch ="Condensed" 
        Click="ChangeFontStretch" TabIndex="3">
  FontStretch
</Button>
void ChangeFontStretch(object sender, RoutedEventArgs e)
{
    if (btn10.FontStretch == FontStretches.Condensed)
    {
        btn10.FontStretch = FontStretches.Normal;
        btn10.Content = "Control FontStretch changes from Condensed to Normal.";
    }
    else
    {
        btn10.FontStretch = FontStretches.Condensed;
        btn10.Content = "FontStretch";
    }
}

Remarks

This property only affects a control whose template uses the FontStretch property as a parameter. On other controls, this property has no impact.

Dependency Property Information

Item Value
Identifier field FontStretchProperty
Metadata properties set to true AffectsMeasure, AffectsRender, Inherits

Applies to

製品 バージョン
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9