共用方式為


Viewbox.Stretch 屬性

定義

取得或設定 ViewboxStretch 模式,這個模式決定如何將內容放入可用空間中。

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

屬性值

Stretch

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

備註

相依性屬性資訊

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

適用於

另請參閱