Convert an image to a reusable ImageBrush resource

An ImageBrush is a type of TileBrush that uses an image as its source. You can create an image brush resource from an image file, and then apply that brush resource to another object.


If you want to include other types of objects in your brush resource, see one the following topics:

To convert an existing image on the artboard into a brush resource

  1. Add an image file to your project by clicking Add Existing Item on the File menu, browsing to your image file, and then clicking Open.

  2. In the Projects panel, double-click the image file to add it to the artboard.

    The image file is added as an Image object that you can resize and modify on the artboard.

  3. In the Objects and Timeline panel, select the Image object that you created in the previous step.

  4. On the Tools menu, point to Make Brush Resource, and then click Make ImageBrush Resource. An image brush can paint an area with an image. It is a type of tile brush that defines its content as an image.

    The Create ImageBrush Resource dialog box opens.

  5. Under Name (Key), enter a name for your image 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 the option where you want the image 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 image remains in your document.

  8. You can view the new image brush resource in the Resources tab, from which you can drag it onto another object on the artboard and select the brush property to apply it to.

  9. For more methods of applying a resource, see Apply a solid color or gradient brush to an object's fill or stroke.

To create a new brush resource in the Resources panel

  1. If you want to create a brush resource in a new resource dictionary, click Create new resource dictionary Cc304472.35c35d1d-ac87-42f7-adc4-d620dbe60297(en-us,Expression.40).png, type a name for the resource dictionary, and then click OK.

    Otherwise, you can select an existing location later in this procedure when you create your brush resource.

  2. Copy image data to the Clipboard. For example, you could right-click an image file in Windows Explorer and click Copy, or capture a screen image, or use the Copy feature in a design program to copy a portion of an image.

  3. In the Resources panel of Microsoft Expression Blend, right-click the location where you want to save the image brush resource, and then click Paste. For example, you could right-click one of the following locations:

    • The App.xaml file   Right-click this location to make your image brush resource available to all the documents and objects in your application.

    • A resource dictionary file   Right-click this location to save your image brush in a resource dictionary. A resource dictionary can be linked to the App.xaml file, to another resource dictionary, or to the root object of the document that is open on the artboard.

    • An object in the open document   Right-click this location to make the image brush resource available only to the selected object.

    A new image brush resource is created. You can now drag the resource onto objects on the artboard to apply the resource to one of the brush properties of the object.

See also

Send feedback about this topic to Microsoft. © 2011 Microsoft Corporation. All rights reserved.