Upraviť

Zdieľať cez


MediaElement.Stretch Property

Definition

Gets or sets a Stretch value that describes how a MediaElement fills the destination rectangle.

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

Property Value

The stretch value for the rendered media. The default is Uniform.

Examples

The following example shows how to create a Viewbox and set the Stretch mode of content.


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

The following illustration demonstrates the different Stretch values.

Different TileBrush Stretch settings
Different gradient spread methods

Dependency Property Information

Identifier field StretchProperty
Metadata properties set to true AffectsMeasure

Applies to