MediaElement.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 determines the restrictions on scaling that are applied to the image.
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
The value that specifies the direction the element is stretched. The default is Both.
Examples
<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="SDKSample.StretchMediaElementExample" >
<StackPanel>
<!-- This Canvas creates the bounding rectangle around the MediaElement.
How the rendered media fills this rectangle depends on the value
of the MediaElement's Stretch property. -->
<StackPanel Width="380" Height="250" Background="Green" Orientation="Horizontal" >
<MediaElement Source="media\bee.wmv" Name="myMediaElement" Stretch="UniformToFill"
/>
</StackPanel>
<!-- Buttons below change the value of the Stretch property. -->
<Button Name="btnFill" Click="OnClickChangeStretch">Fill</Button>
<Button Name="btnNone" Click="OnClickChangeStretch">None</Button>
<Button Name="btnUniform" Click="OnClickChangeStretch">Uniform</Button>
<Button Name="btnUniformToFill" Click="OnClickChangeStretch">UniformToFill</Button>
<TextBlock Name="txt1"></TextBlock>
</StackPanel>
</Page>
<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="SDKSample.StretchMediaElementExample" >
<StackPanel>
<!-- This Canvas creates the bounding rectangle around the MediaElement.
How the rendered media fills this rectangle depends on the value
of the MediaElement's Stretch property. -->
<StackPanel Width="380" Height="250" Background="Green" Orientation="Horizontal" >
<MediaElement Source="media\bee.wmv" Name="myMediaElement" Stretch="UniformToFill"
/>
</StackPanel>
<!-- Buttons below change the value of the Stretch property. -->
<Button Name="btnFill" Click="OnClickChangeStretch">Fill</Button>
<Button Name="btnNone" Click="OnClickChangeStretch">None</Button>
<Button Name="btnUniform" Click="OnClickChangeStretch">Uniform</Button>
<Button Name="btnUniformToFill" Click="OnClickChangeStretch">UniformToFill</Button>
<TextBlock Name="txt1"></TextBlock>
</StackPanel>
</Page>
Remarks
Dependency Property Information
Identifier field | StretchDirectionProperty |
Metadata properties set to true |
AffectsMeasure |
Applies to
See also
GitHub에서 Microsoft와 공동 작업
이 콘텐츠의 원본은 GitHub에서 찾을 수 있으며, 여기서 문제와 끌어오기 요청을 만들고 검토할 수도 있습니다. 자세한 내용은 참여자 가이드를 참조하세요.
.NET