Skip to main content
.NET Framework Class Library
ControlFontStretch Property

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

Namespace:   System.Windows.Controls
Assembly:  PresentationFramework (in PresentationFramework.dll)
XMLNS for XAML: http://schemas.microsoft.com/winfx/2006/xaml/presentation, http://schemas.microsoft.com/netfx/2007/xaml/presentation
Syntax
<[%$TOPIC/ms592515_en-us_VS_110_1_0_0_0_0%](True)> _
Public Property FontStretch As [%$TOPIC/ms592515_en-us_VS_110_1_0_0_0_1%]
[[%$TOPIC/ms592515_en-us_VS_110_1_0_1_0_0%](true)]
public [%$TOPIC/ms592515_en-us_VS_110_1_0_1_0_1%] FontStretch { get; set; }
[[%$TOPIC/ms592515_en-us_VS_110_1_0_2_0_0%](true)]
public:
property [%$TOPIC/ms592515_en-us_VS_110_1_0_2_0_1%] FontStretch {
	[%$TOPIC/ms592515_en-us_VS_110_1_0_2_0_2%] get ();
	void set ([%$TOPIC/ms592515_en-us_VS_110_1_0_2_0_3%] value);
}
[<[%$TOPIC/ms592515_en-us_VS_110_1_0_3_0_0%](true)>]
member FontStretch : [%$TOPIC/ms592515_en-us_VS_110_1_0_3_0_1%] with get, set
function get FontStretch () : [%$TOPIC/ms592515_en-us_VS_110_1_0_4_0_0%] 
function set FontStretch (value : [%$TOPIC/ms592515_en-us_VS_110_1_0_4_0_1%])
<object FontStretch="[%$TOPIC/ms592515_en-us_VS_110_1_0_5_0_0%]" .../>

Property Value

Type: System.WindowsFontStretch
A FontStretch value. The default is FontStretchesNormal.
Remarks

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

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>
Private Sub ChangeFontStretch(ByVal Sender As Object, ByVal e As RoutedEventArgs)

    If (btn10.FontStretch = FontStretches.Condensed) Then

        btn10.FontStretch = FontStretches.Normal
        btn10.Content = "Control FontStretch changes from Condensed to Normal." 
    Else
        btn10.Content = "FontStretch"
        btn10.FontStretch = FontStretches.Condensed
    End If 

End Sub
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";
    }
}
Version Information

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1