Partager via


Stretch (VideoBrush)

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Gets or sets a value that specifies how the video of a VideoBrush should be stretched to fill the painted area.

<object Stretch="Stretch"  .../>
value = object.Stretch
object.Stretch = value

Property Value

Type: Stretch

One of the enumeration values that specifies how this brush's video content stretches to fill the painted area.

This property is read/write. The default value is Fill.

Managed Equivalent

Stretch

Remarks

The Stretch property accepts the following values, which the Stretch enumeration defines:

  • None: The video does not stretch to fill the output dimensions.

  • Uniform: The video is scaled to fit the output dimensions. However, the aspect ratio of the content is preserved.

  • UniformToFill: The video is scaled so that it completely fills the output area, but it preserves its original aspect ratio.

  • Fill: The video is scaled to fit the output dimensions. Because the content's height and width are scaled independently, the original aspect ratio of the video might not be preserved. That is, the video might be distorted in order to completely fill the output area.

The following image illustrates the different Stretch settings.

Different Stretch settings

Stretch values.

A Stretch property also exists on MediaElement and could be set on the MediaElement that is referenced as the SourceName for a VideoBrush. However, setting the Stretch value on the MediaElement would not influence the stretch characteristics when the video is applied to the VideoBrush. You would instead set Stretch on the VideoBrush.

Applies To

VideoBrush