Create a brush resource or color resource

You can create a reusable brush or color that you can then apply to other objects. Resources have an advantage over copying and applying attributes because you can change the resource in one location. When you do this, all the objects that use the resource are instantly updated.

Note

You have many ways to create a resource in Blend for Visual Studio 2012. This topic covers only how to create brush and color resources, but you can create a resource from most properties. Additionally, you can create a style or template resource that you can apply to a control, instantly changing the appearance or behavior of the control. For more information about how to create additional resource types, see Creating reusable resources. You can see all the resources that are used in your project in the Resources panel.

To create a brush resource

  1. If you do not already have an object on the artboard with a brush property that you want to convert to a resource, you can select Ellipse 8938cfdf-9b75-4a33-bc88-b0636e114a0d from the Tools panel, and draw an ellipse on the artboard. The properties panel will display the properties for the new ellipse object, with the Fill property selected under Brush.

  2. Under Brush in the Properties panel, click the Solid color brush tab 3a66ec96-47bb-47fc-8876-6b9456feec3a, the Gradient brush tab 91fb0c61-7b3b-4ae7-8a59-760e625e3bd7, or the Tile brush tab 14623a18-70ab-450f-af01-ae9902d60e4d to begin setting properties for your brush.

  3. When you are ready to save the brush, click Advanced options 12e06962-5d8a-480d-a837-e06b84c545bb next to the brush property (such as the Fill or Background property), and then click Convert to New Resource.

    The Create Brush Resource dialog box appears

    092a1fec-f5b5-427c-a51e-aae1f6a1eee2

  4. In the Create Brush Resource dialog box, enter a name (key) for your new resource, select where you want the resource to be defined (such as at the application-level, document-level, object-level, or as a part of a resource dictionary), and then click OK.

  5. You can view and modify the brush resource that you created in the Resources panel.

    Viewing and modifying a brush resource in the Resources panel

    64136c65-52bc-4225-a948-b1171634baca

To apply a brush resource to another object

  1. Select the object to which you want to apply the brush resource.

  2. Under Brush in the Properties panel, select the brush property that you want to change.

  3. Click the Brush resources tab 415db740-5a54-48d2-8678-245ccfa7ee8b.

  4. Under Local Brush Resources, select the brush resource that you want to apply to the object.

    Setting the Fill property of the selected object to the Brush1 resource

    af28e5e4-4861-45ac-b02d-e65386520ed7

    Note

    You have other ways to apply a resource to an object, such as dragging the resource onto the artboard or using the Advanced options drop-down menu 12e06962-5d8a-480d-a837-e06b84c545bb. For more information, see Apply or remove a resource.

To create a color resource

  1. If you do not already have an object on the artboard with a color property that you want to convert to a resource, you can select Ellipse 8938cfdf-9b75-4a33-bc88-b0636e114a0d from the Tools panel, and draw an ellipse on the artboard. The Properties panel will display the properties for the new ellipse object, with the Fill property selected under Brush.

  2. Under Brush in the Properties panel, click the Solid color brush tab 3a66ec96-47bb-47fc-8876-6b9456feec3a or the Gradient brush tab 91fb0c61-7b3b-4ae7-8a59-760e625e3bd7. Select a color in the color editor. If you are modifying a Gradient brush 91fb0c61-7b3b-4ae7-8a59-760e625e3bd7, you can select a color for each gradient stop a3c9e482-e99b-4504-8a02-9507487d1791.

    Tip

    A Color eyedropper 2ab2d2fb-3478-4b33-87fb-3cdeb9df4d52 appears in the lower-right corner of the color Editor when you are modifying a Solid color brush 3a66ec96-47bb-47fc-8876-6b9456feec3a or a gradient stop on a Gradient brush 91fb0c61-7b3b-4ae7-8a59-760e625e3bd7. With this eyedropper selected, you can grab a color sample from anywhere on your desktop and apply it to the selected brush. When you modify a Gradient brush 91fb0c61-7b3b-4ae7-8a59-760e625e3bd7, you can select the Gradient eyedropper Gradient eyedropper icon and drag a line across a sample of a color anywhere inside the Blend for Visual Studio 2012 application window to apply it to the brush. You can press the ESC key at any time to cancel out of the eyedroppers.

  3. When you are ready to save the color, click Convert color to resource 6bf68607-add8-4d87-b6f4-100c8f05dd17.

    Converting a color to a resource

    89203705-cf66-46e0-b153-52a23cd744f7

    The Create Color Resource dialog box appears

    6bff8b19-3cd5-41a0-bbf9-ff65532d5aae

  4. In the Create Color Resource dialog box, enter a name (key) for your new resource, select where you want the resource to be defined (such as at the application-level, document-level, object-level, or as a part of a resource dictionary), and then click OK.

  5. You can view and modify the color resource that you created in the Resources panel, just as you can view and modify a brush resource.

To apply a color resource to another object

  1. Select the object to which you want to apply the color resource.

  2. Under Brush in the Properties panel, select the brush property that you want to change.

  3. Click the Color resources.

  4. Under Local Color Resources, select the color resource that you want to apply to the object.

    Setting the Fill property of the selected object to the Color1 resource

    5cb88f90-c17a-4dad-be87-b6be7d74f410

See Also

Tasks

Convert an image to a reusable ImageBrush resource

Copy or apply attributes to an object

Add or remove a gradient stop