Convert a video into a reusable VideoBrush resource

Hh134793.0b2c798e-86c6-4ea2-a8a6-5cf1f12be1e2(en-us,Expression.40).png

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

  1. On the Project menu, click Add Existing Item.

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

Video appears in the Resources panel

To make the video into a VideoBrush resource

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

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

    Create VideoBrush Resource dialog box

  3. In the Create VideoBrush Resource dialog box, type a name for the VideoBrush in the Name field, or keep the default name.

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

Apply VideoBrushResource

It also appears in Code view as a VideoBrush.

VideoBrush in Code view

To apply the VideoBrush as a Fill

  1. Add an object to the artboard. In this example, an ellipse has been added to the artboard.

    Ellipse on the artboard

  2. Select the Ellipse in the Objects and Timeline panel. In the Brush category of the Properties panel, click Fill, then click Brush resources Hh134793.415db740-5a54-48d2-8678-245ccfa7ee8b(en-us,Expression.40).png, and then click your new video brush.

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

  4. Press F5 to build and run your project.

    The video displays inside the ellipse.

    Ellipse with VideoBrush applied

  5. 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 Hh134793.14623a18-70ab-450f-af01-ae9902d60e4d(en-us,Expression.40).png, and then select one of the following from the Stretch drop-down list:

    1. None   The content preserves its original size.

      VideoBrush Stretch: None

    2. Fill   The content is resized to fill the dimensions of the object. The aspect ratio is not preserved.

      VideoBrush Stretch: Fill

    3. Uniform   The content is resized to fit the dimensions of the object while preserving the aspect ratio.

      VideoBrush Stretch: Uniform

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

      VideoBrush Stretch: UniformToFill

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.