Control.FontStretch Property

Definition

Important

Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

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

C#
[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.

XAML
<Button Name="btn10" FontStretch ="Condensed" 
        Click="ChangeFontStretch" TabIndex="3">
  FontStretch
</Button>
C#
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

Product Versions
.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, 10