Export (0) Print
Expand All

Viewbox.StretchDirection Property

Gets or sets the StretchDirection, which determines how scaling is applied to the contents of a Viewbox.

Namespace: System.Windows.Controls
Assembly: PresentationFramework (in presentationframework.dll)
XML Namespace:  http://schemas.microsoft.com/winfx/2006/xaml/presentation

public StretchDirection StretchDirection { get; set; }
/** @property */
public StretchDirection get_StretchDirection ()

/** @property */
public void set_StretchDirection (StretchDirection value)

public function get StretchDirection () : StretchDirection

public function set StretchDirection (value : StretchDirection)

<object StretchDirection="StretchDirection" .../>

Property Value

A StretchDirection that determines how scaling is applied to the contents of a Viewbox. The default is Both.

This property determines the scaling restrictions that apply to the contents of a Viewbox. For example, use this property to prevent the contents of a Viewbox from being smaller or larger than its original size.

The following example shows how to create an instance of Viewbox and then set the StretchDirection property 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;

More Code

How to: Apply Stretch Properties to the Contents of a Viewbox

This example shows how to change the value of the StretchDirection and Stretch properties of a Viewbox.

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0

Community Additions

ADD
Show:
© 2014 Microsoft