StretchDirection 枚举

定义

描述如何对内容应用缩放,并限制对已命名像素类型的缩放。

C#
public enum StretchDirection
继承
StretchDirection

字段

名称 说明
Both 2

内容将根据 Stretch 模式进行拉伸以适应父级。

DownOnly 1

内容仅在大于父级时缩放。 如果内容较小,则不会执行任何扩展。

UpOnly 0

内容仅在小于父级时扩展。 如果内容较大,则不执行缩放。

示例

以下示例演示如何使用代码创建 的 Viewbox 实例并设置 StretchDirection 内容的 。

C#

// 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;

适用于

产品 版本
.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

另请参阅