Create a brush or color resource

This page applies to WPF and Silverlight 2

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 Microsoft Expression Blend. 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 Resources overview. 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 the Ellipse Cc294725.8938cfdf-9b75-4a33-bc88-b0636e114a0d(en-us,Expression.10).png tool from the Toolbox, 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 Brushes.

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

  3. When you are ready to save the brush, click the Convert brush to resource Cc294725.c8731c39-2e16-47f5-acf0-1c92a8a5381e(en-us,Expression.10).png button.

    Converting a brush to a resource

    Cc294725.fdc0c10a-e13a-46cd-8cf8-42189fd20550(en-us,Expression.10).png

    The Create Brush Resource dialog box appears

    Cc294725.092a1fec-f5b5-427c-a51e-aae1f6a1eee2(en-us,Expression.10).png

  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

    Cc294725.64136c65-52bc-4225-a948-b1171634baca(en-us,Expression.10).png

To apply a brush resource to another object

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

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

  3. Click the Brush resources Cc294725.415db740-5a54-48d2-8678-245ccfa7ee8b(en-us,Expression.10).png tab.

  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

    Cc294725.af28e5e4-4861-45ac-b02d-e65386520ed7(en-us,Expression.10).png

    Note

    You have other ways to apply a resource to an object, such as dragging the resource onto the artboard or using the Advanced property options Cc294725.d6ba8f4a-b8a2-445a-af0b-a267dfade6e1(en-us,Expression.10).png drop-down menu. 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 the Ellipse Cc294725.8938cfdf-9b75-4a33-bc88-b0636e114a0d(en-us,Expression.10).png tool from the Toolbox, 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 Brushes.

  2. Under Brushes in the Properties panel, click the Solid color brush Cc294725.3a66ec96-47bb-47fc-8876-6b9456feec3a(en-us,Expression.10).png or Gradient brush Cc294725.91fb0c61-7b3b-4ae7-8a59-760e625e3bd7(en-us,Expression.10).png tab. Select a color in the color editor. If you are modifying a Gradient brush Cc294725.91fb0c61-7b3b-4ae7-8a59-760e625e3bd7(en-us,Expression.10).png, you can select a color for each gradient stop Cc294725.d45e017e-3123-4fc1-9d99-e87b4e3e2202(en-us,Expression.10).png.

    Tip

    A Color eyedropper Cc294725.2ab2d2fb-3478-4b33-87fb-3cdeb9df4d52(en-us,Expression.10).png appears in the lower-right corner of the color Editor when you are modifying a Solid color brush Cc294725.3a66ec96-47bb-47fc-8876-6b9456feec3a(en-us,Expression.10).png or a gradient stop on a Gradient brush Cc294725.91fb0c61-7b3b-4ae7-8a59-760e625e3bd7(en-us,Expression.10).png. 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 Cc294725.91fb0c61-7b3b-4ae7-8a59-760e625e3bd7(en-us,Expression.10).png, you can select the Gradient eyedropper Cc294725.2ab2d2fb-3478-4b33-87fb-3cdeb9df4d52(en-us,Expression.10).png and drag a line across a sample of a color anywhere inside the Microsoft Expression Blend 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 the Convert color to resource Cc294725.6bf68607-add8-4d87-b6f4-100c8f05dd17(en-us,Expression.10).png button.

    Converting a color to a resource

    Cc294725.89203705-cf66-46e0-b153-52a23cd744f7(en-us,Expression.10).png

    The Create Color Resource dialog box appears

    Cc294725.6bff8b19-3cd5-41a0-bbf9-ff65532d5aae(en-us,Expression.10).png

  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 Brushes 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

    Cc294725.5cb88f90-c17a-4dad-be87-b6be7d74f410(en-us,Expression.10).png

See also

Concepts

Appearance overview

Copy or apply attributes to an object

Add or remove a gradient stop

Transform a gradient or tile brush

Copy or apply attributes to an object