Microsoft Silverlight will reach end of support after October 2021. Learn more.
Paints an area with video content.
Assembly: System.Windows (in System.Windows.dll)
'Declaration Public NotInheritable Class VideoBrush _ Inherits TileBrush
public sealed class VideoBrush : TileBrush
The VideoBrush type exposes the following members.
|VideoBrush||Initializes a new instance of the VideoBrush class.|
|AlignmentX||Gets or sets the horizontal alignment of content in the TileBrush base tile. (Inherited from TileBrush.)|
|AlignmentY||Gets or sets the vertical alignment of content in the TileBrush base tile. (Inherited from TileBrush.)|
|Dispatcher||Gets the Dispatcher this object is associated with. (Inherited from DependencyObject.)|
|Opacity||Gets or sets the degree of opacity of a Brush. (Inherited from Brush.)|
|RelativeTransform||Gets or sets the transformation that is applied to the brush using relative coordinates. (Inherited from Brush.)|
|SourceName||Gets or sets the name of the MediaElement to use as the source of the VideoBrush.|
|Stretch||Gets or sets a value that specifies how the content of this TileBrush stretches to fit its tiles. (Inherited from TileBrush.)|
|Transform||Gets or sets the transformation that is applied to the brush. (Inherited from Brush.)|
|CheckAccess||Determines whether the calling thread has access to this object. (Inherited from DependencyObject.)|
|ClearValue||Clears the local value of a dependency property. (Inherited from DependencyObject.)|
|Equals(Object)||Determines whether the specified Object is equal to the current Object. (Inherited from Object.)|
|Finalize||Allows an object to try to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection. (Inherited from Object.)|
|GetAnimationBaseValue||Returns any base value established for a Silverlight dependency property, which would apply in cases where an animation is not active. (Inherited from DependencyObject.)|
|GetHashCode||Serves as a hash function for a particular type. (Inherited from Object.)|
|GetType||Gets the Type of the current instance. (Inherited from Object.)|
|GetValue||Returns the current effective value of a dependency property from a DependencyObject. (Inherited from DependencyObject.)|
|MemberwiseClone||Creates a shallow copy of the current Object. (Inherited from Object.)|
|ReadLocalValue||Returns the local value of a dependency property, if a local value is set. (Inherited from DependencyObject.)|
|SetSource(CaptureSource)||Sets the source of the VideoBrush using a video capture source|
|SetSource(MediaElement)||Sets the source of the VideoBrush using a media file source from an intermediary MediaElement control.|
|SetValue||Sets the local value of a dependency property on a DependencyObject. (Inherited from DependencyObject.)|
|ToString||Returns a string that represents the current object. (Inherited from Object.)|
A detailed walkthrough of how to use a VideoBrush is documented in VideoBrush Overview.
A VideoBrush is a type of Brush object similar to a LinearGradientBrush or an ImageBrush. However, instead of painting an area with a solid color, a gradient, or an image, it paints an area with video content. This video content is provided by a MediaElement. Just like the other brush types, you can use a VideoBrush to paint the Fill of a shape such as a Rectangle or the geometry contents of a Path, the Background of a Canvas, or the Foreground of a TextBlock or Run.
To use a VideoBrush, you create a MediaElement, apply the VideoBrush to the object that you want to paint, and set the VideoBrush object's SourceName property to the name of the MediaElement that you created.
Silverlight 4 introduces an overload of SetSource(CaptureSource) that is used for webcam scenarios. For this scenario, you set the source video for a VideoBrush using a CaptureSource. For more information on obtaining a CaptureSource and webcam scenarios, see CaptureSource and VideoSink.
<Canvas xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> <MediaElement x:Name="butterflyMediaElement" Source="sampleMedia/Butterfly.wmv" IsMuted="True" Opacity="0.0" IsHitTestVisible="False" /> <TextBlock Canvas.Left="5" Canvas.Top="30" FontFamily="Verdana" FontSize="120" FontWeight="Bold" TextWrapping="Wrap" Text="Video"> <!-- Paint the text with video. --> <TextBlock.Foreground> <VideoBrush SourceName="butterflyMediaElement" Stretch="UniformToFill" /> </TextBlock.Foreground> </TextBlock> </Canvas>
Supported in: 5, 4, 3
Silverlight for Windows Phone
Supported in: Windows Phone OS 7.1
For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.