Partilhar via


Convert objects into a reusable VisualBrush resource

JJ170528.bf9c77b1-ba7a-4f3b-8380-d05728d208d1(pt-br,VS.110).png

You can convert existing objects on the artboard into a visual brush resource that you can then apply to other objects. A visual brush can include any object that derives from the UIElement class, including shapes, text, video, images, or other types of visuals as defined by the Visual class.

For more information about the Visual class, see Visual Class on MSDN.

For more information about the UIElement class, see UIElement on MSDN.

To create a visual brush resource

  1. In the Objects and Timeline panel, hold the CTRL key when you select all the objects that you want to use to define the appearance of the new visual brush. Alternatively, you can use the Selection tool JJ170528.2ff91340-477e-4efa-a0f7-af20851e4daa(pt-br,VS.110).png when you hold the CTRL key to select the objects on the artboard.

  2. On the Object menu, click Group Into, and then select a layout panel in which to group the objects. For example, select the Grid layout panel to group the objects into a grid.

  3. Select the new layout panel.

  4. On the Tools menu, click Make Brush Resource, and then click Make VisualBrush Resource.

    The Create VisualBrush Resource dialog box appears.

  5. Under Name (Key), enter a name for your visual brush resource. This is the name by which other objects can reference the resource, thereby applying the resource to themselves.

  6. Under Define in, select one of the following options where you want the visual brush resource to be defined:

    • To make the resource available to any document in your application, select Application.

    • To make the resource available only to the current document, select This document (Window: Window).

    • To make the resource available only to the object from which you created the resource or its child objects, select This document (object).

    • To define the resource in a resource dictionary file that you can reuse in other projects, select an existing Resource dictionary, or click the New button to create a new resource dictionary.

  7. Click OK to close the dialog box and create the resource. The original objects remain intact in your document.

    You can view the new visual brush resource in the Resources tab, from where you can drag it onto another object on the artboard and select the brush property to apply it to. For more methods of applying a resource, see Apply a solid color or gradient brush to an object's fill or stroke.