Image.StretchDirection Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets or sets a value that indicates how the image is scaled.
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
One of the StretchDirection values. The default is Both.
Examples
The following example demonstrates how to use this property.
Image myImage1 = new Image();
// Set the stretch property.
myImage1.Stretch = Stretch.Fill;
// Set the StretchDirection property.
myImage1.StretchDirection = StretchDirection.Both;
// Create source
BitmapImage myBitmapImage1 = new BitmapImage();
// BitmapImage.UriSource must be in a BeginInit/EndInit block
myBitmapImage1.BeginInit();
myBitmapImage1.UriSource = new Uri(@"C:\Documents and Settings\All Users\Documents\My Pictures\Sample Pictures\Winter.jpg");
myBitmapImage1.EndInit();
//set image source
myImage1.Source = myBitmapImage1;
Dim myImage1 As New Image()
' Set the stretch property.
myImage1.Stretch = Stretch.Fill
' Set the StretchDirection property.
myImage1.StretchDirection = StretchDirection.Both
' Create source
Dim myBitmapImage1 As New BitmapImage()
' BitmapImage.UriSource must be in a BeginInit/EndInit block
myBitmapImage1.BeginInit()
myBitmapImage1.UriSource = New Uri("C:\Documents and Settings\All Users\Documents\My Pictures\Sample Pictures\Winter.jpg")
myBitmapImage1.EndInit()
'set image source
myImage1.Source = myBitmapImage1
Remarks
Dependency Property Information
Identifier field | StretchDirectionProperty |
Metadata properties set to true |
AffectsMeasure |
Applies to
See also
GitHub에서 Microsoft와 공동 작업
이 콘텐츠의 원본은 GitHub에서 찾을 수 있으며, 여기서 문제와 끌어오기 요청을 만들고 검토할 수도 있습니다. 자세한 내용은 참여자 가이드를 참조하세요.
.NET