MediaElement.StretchDirection Propiedad
Definición
Importante
Parte de la información hace referencia a la versión preliminar del producto, que puede haberse modificado sustancialmente antes de lanzar la versión definitiva. Microsoft no otorga ninguna garantía, explícita o implícita, con respecto a la información proporcionada aquí.
Obtiene o establece un valor que determina las restricciones de escalado que se aplican a la imagen.
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
Valor de propiedad
Valor que especifica la dirección en la que se extiende el elemento. El valor predeterminado es Both.
Ejemplos
<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>
Comentarios
Información de la propiedad dependency
| Elemento | Value |
|---|---|
| Campo identificador | StretchDirectionProperty |
Propiedades de metadatos establecidas en true |
AffectsMeasure |