ערוך

שתף באמצעות


Viewbox.StretchDirection Property

Definition

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

public:
 property System::Windows::Controls::StretchDirection StretchDirection { System::Windows::Controls::StretchDirection get(); void set(System::Windows::Controls::StretchDirection value); };
public System.Windows.Controls.StretchDirection StretchDirection { get; set; }
member this.StretchDirection : System.Windows.Controls.StretchDirection with get, set
Public Property StretchDirection As StretchDirection

Property Value

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

Examples

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

' 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

Remarks

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.

Dependency Property Information

Identifier field StretchDirectionProperty
Metadata properties set to true AffectsMeasure

Applies to

See also