Updated: November 2007
Defines a content decorator that can stretch and scale a single child to fill the available space.
Public Class Viewbox _ Inherits Decorator
Dim instance As Viewbox
public class Viewbox : Decorator
public ref class Viewbox : public Decorator
public class Viewbox extends Decorator
<Viewbox> Child </Viewbox>
Content Model: A Viewbox can only have one Child. If you add an additional Child, you cause an ArgumentException at run time.
The following example shows how to create an instance of a Viewbox and set common properties in code.
' Create a ViewBox and add it to the Canvas Dim myViewbox As New Viewbox() myViewbox.StretchDirection = StretchDirection.Both myViewbox.Stretch = Stretch.Fill myViewbox.MaxWidth = 400 myViewbox.MaxHeight = 400
// Create a Viewbox and add it to the Canvas myViewbox = gcnew Viewbox(); myViewbox->StretchDirection = StretchDirection::Both; myViewbox->Stretch = Stretch::Fill; myViewbox->MaxWidth = 400; myViewbox->MaxHeight = 400;
// 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 Vista