MediaElement.StretchDirection Propriedade
Definição
Importante
Algumas informações dizem respeito a um produto pré-lançado que pode ser substancialmente modificado antes de ser lançado. A Microsoft não faz garantias, de forma expressa ou implícita, em relação à informação aqui apresentada.
Recebe ou define um valor que determina as restrições de escala aplicadas à imagem.
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 Propriedade
O valor que especifica a direção em que o elemento está esticado. A predefinição é Both.
Exemplos
<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>
Observações
Informação de Propriedade de Dependência
| Iteme | Value |
|---|---|
| Campo identificador | StretchDirectionProperty |
Propriedades dos metadados definidas como true |
AffectsMeasure |