StretchDirection Enum

Definition

Describes how scaling applies to content and restricts scaling to named axis types.

public enum StretchDirection
Inheritance
StretchDirection

Fields

Name Value Description
UpOnly 0

The content scales upward only when it is smaller than the parent. If the content is larger, no scaling downward is performed.

DownOnly 1

The content scales downward only when it is larger than the parent. If the content is smaller, no scaling upward is performed.

Both 2

The content stretches to fit the parent according to the Stretch mode.

Examples

The following example shows how to create an instance of Viewbox and set the StretchDirection of content by using code.


// Create a Viewbox and add it to the Canvas
myViewbox = new Viewbox();
myViewbox.StretchDirection = StretchDirection.Both;
myViewbox.Stretch = Stretch.Fill;
myViewbox.MaxWidth = 400;
myViewbox.MaxHeight = 400;

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

See also