MediaElement.Stretch 屬性

定義

取得或設定說明 Stretch 如何填滿目的矩形的 MediaElement 值。

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

屬性值

呈現之媒體的自動縮放值。 預設為 Uniform

範例

下列範例示範如何建立 Viewbox 並設定 Stretch 內容模式。


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

備註

下圖示范不同的 Stretch 值。

不同的 TileBrush Stretch 設定不同的
不同的漸層散佈方法

相依性屬性資訊

識別碼欄位 StretchProperty
設定為 的中繼資料屬性 true AffectsMeasure

適用於