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
Vertu í samstarfi við okkur á GitHub
Heimildina fyrir þetta efni er að finna á GitHub, þar sem þú getur líka búið til og farið yfir vandamál og sameinað beiðnir. Frekari upplýsingar er að finna í framlagshandbók okkar.