Describes how content is resized to fill its allocated space.
Namespace: System.Windows.Media Assembly: PresentationCore (in presentationcore.dll) XML Namespace: http://schemas.microsoft.com/winfx/2006/xaml/presentation
The content is resized to fill the destination dimensions. The aspect ratio is not preserved.
The content preserves its original size.
The content is resized to fit in the destination dimensions while it preserves its native aspect ratio.
The content is resized to fill the destination dimensions while it preserves its native aspect ratio. If the aspect ratio of the destination rectangle differs from the source, the source content is clipped to fit in the destination dimensions.
// 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;
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.