語言

MediaElement.Stretch 屬性

定義

取得或設定一個 Stretch 值,描述 a 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 拉伸設定 不同的梯度擴散方法

相依財產資訊

Item 價值觀
識別碼欄位 StretchProperty
元資料屬性設為 true AffectsMeasure

適用於