Export (0) Print
Expand All

VideoBrush Class

Paints an area with video content.

Namespace:  System.Windows.Media
Assembly:  System.Windows (in System.Windows.dll)

public sealed class VideoBrush : TileBrush
<VideoBrush .../>

The VideoBrush type exposes the following members.

  NameDescription
Public methodSupported by Silverlight for Windows PhoneVideoBrushInitializes a new instance of the VideoBrush class.
Top

  NameDescription
Public propertySupported by Silverlight for Windows PhoneAlignmentXGets or sets the horizontal alignment of content in the TileBrush base tile. (Inherited from TileBrush.)
Public propertySupported by Silverlight for Windows PhoneAlignmentYGets or sets the vertical alignment of content in the TileBrush base tile. (Inherited from TileBrush.)
Public propertySupported by Silverlight for Windows PhoneDispatcherGets the Dispatcher this object is associated with. (Inherited from DependencyObject.)
Public propertySupported by Silverlight for Windows PhoneOpacityGets or sets the degree of opacity of a Brush. (Inherited from Brush.)
Public propertySupported by Silverlight for Windows PhoneRelativeTransformGets or sets the transformation that is applied to the brush using relative coordinates. (Inherited from Brush.)
Public propertySupported by Silverlight for Windows PhoneSourceNameGets or sets the name of the MediaElement to use as the source of the VideoBrush.
Public propertySupported by Silverlight for Windows PhoneStretchGets or sets a value that specifies how the content of this TileBrush stretches to fit its tiles. (Inherited from TileBrush.)
Public propertySupported by Silverlight for Windows PhoneTransformGets or sets the transformation that is applied to the brush. (Inherited from Brush.)
Top

  NameDescription
Public methodSupported by Silverlight for Windows PhoneCheckAccessDetermines whether the calling thread has access to this object. (Inherited from DependencyObject.)
Public methodSupported by Silverlight for Windows PhoneClearValueClears the local value of a dependency property. (Inherited from DependencyObject.)
Public methodSupported by Silverlight for Windows PhoneEquals(Object)Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected methodSupported by Silverlight for Windows PhoneFinalizeAllows an object to try to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection. (Inherited from Object.)
Public methodSupported by Silverlight for Windows PhoneGetAnimationBaseValueReturns any base value established for a Silverlight dependency property, which would apply in cases where an animation is not active. (Inherited from DependencyObject.)
Public methodSupported by Silverlight for Windows PhoneGetHashCodeServes as a hash function for a particular type. (Inherited from Object.)
Public methodSupported by Silverlight for Windows PhoneGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodSupported by Silverlight for Windows PhoneGetValueReturns the current effective value of a dependency property from a DependencyObject. (Inherited from DependencyObject.)
Protected methodSupported by Silverlight for Windows PhoneMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodSupported by Silverlight for Windows PhoneReadLocalValueReturns the local value of a dependency property, if a local value is set. (Inherited from DependencyObject.)
Public methodSupported by Silverlight for Windows PhoneSetSource(CaptureSource)Sets the source of the VideoBrush using a video capture source
Public methodSupported by Silverlight for Windows PhoneSetSource(MediaElement)Sets the source of the VideoBrush using a media file source from an intermediary MediaElement control.
Public methodSupported by Silverlight for Windows PhoneSetValueSets the local value of a dependency property on a DependencyObject. (Inherited from DependencyObject.)
Public methodSupported by Silverlight for Windows PhoneToStringReturns a string that represents the current object. (Inherited from Object.)
Top

  NameDescription
Public fieldStatic memberSupported by Silverlight for Windows PhoneSourceNamePropertyIdentifies the SourceName dependency property.
Top

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.

The following example uses a VideoBrush to paint the Foreground of a TextBlock.

Run this sample


<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>


Silverlight

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.

Community Additions

Show:
© 2014 Microsoft