Convert a video into a reusable VideoBrush resource
You can apply a video as a Fill by making a video into a VideoBrush resource.
To make a video into a video brush, you begin by adding a video to your project. You then make the video into a VideoBrush resource. After you create your video brush, you can then apply the video brush to the fill of an object.
To add a video to the project
On the Project menu, click Add Existing Item.
In the Add Existing Item dialog box, locate the video that you want to add, and then click Open.
Tip
For this example, use an image from the Sample Videos folder.
The video is added to the Projects panel. A MediaElement with the same name as your video also appears in the Resources panel.
To make the video into a VideoBrush resource
Add the video to the artboard by right-clicking the video in the Projects panel and then clicking Insert.
A MediaElement control with the same name as your video appears in the Objects and Timeline panel.
With the MediaElement selected, in the Tools panel, click Make Brush Resource, and then click Make VideoBrush Resource.
The Create VideoBrush Resource dialog box appears.
In the Create VideoBrush Resource dialog box, type a name for the VideoBrush in the Name field, or keep the default name.
Under Define in, select where you want the template to be defined:
To make the template available to a button object in any document in your application, select Application.
To make the template available only to button objects in the current document, select This document.
To make the template available only to this MediaElement in this document, select MediaElement from the drop-down box beside This document.
Click OK.
The video now appears in the Brush category of the Properties panel as a Brush resource.
It also appears in Code view as a VideoBrush.
To apply the VideoBrush as a Fill
Add an object to the artboard. In this example, an ellipse has been added to the artboard.
Select the Ellipse in the Objects and Timeline panel. In the Brush category of the Properties panel, click Fill, then click Brush resources , and then click your new video brush.
If you run your project now, the video will display in both the MediaElement and the Ellipse. To prevent this, in the Objects and Timeline panel, select the MediaElement control (in this case Wildlife_wmv). In the Appearance category of the Properties panel, set the Opacity to 0.
Press F5 to build and run your project.
The video displays inside the ellipse.
You can further modify the appearance of the video inside the control by modifying the Stretch property. In the Brushes category in the Properties panel, click Tile brush , and then select one of the following from the Stretch drop-down list:
None The content preserves its original size.
Fill The content is resized to fill the dimensions of the object. The aspect ratio is not preserved.
Uniform The content is resized to fit the dimensions of the object while preserving the aspect ratio.
UniformToFill The content is resized to fill the dimensions of the object while preserving the aspect ratio. If the aspect ratio of the destination object differs from the source content, the source content is clipped to fit in the object dimensions.
See also
Tasks
Modify the appearance of an object by using brushes
Concepts
Setting colors, brushes, and masks
Send feedback about this topic to Microsoft. © 2011 Microsoft Corporation. All rights reserved.