XAML WPF drawing brush and resource dictionary
You can save Microsoft Expression Design artwork as a drawing brush resource in a XAML Windows Presentation Foundation (WPF) (WPF) resource dictionary that you can import into a Microsoft Expression Blend project. You can use a drawing brush resource in an Expression Blend project to paint any object. For example, you could create artwork for the appearance of a button in Expression Design, export the artwork as a brush resource in a resource dictionary, import the resource dictionary into Expression Blend, and then apply the brush resource to the Background property of a Button control, or apply it to the Fill property of a Rectangle.
Additionally, you can export one or many slices of your artwork as individual XAML brush resources in a XAML WPF resource dictionary.
Resource dictionaries are useful because they can contain all the resources that make up the unique look of your application in one file. You can add a resource dictionary to any WPF project in Expression Blend, and then apply the brush resources in the resource dictionary to the brush properties of any object in the project.
Colors in your exported XAML code are based on RGB and are not color managed. If you use a custom color monitor profile, the colors you see in Expression Design may differ from those displayed in your final XAML-editing software.
To export art as brush resources in a XAML WPF resource dictionary
On the File menu, click Export. The Export dialog box displays your artwork in a preview window.
Under Items to Export, select one of the following options:
Whole document Select this option to automatically export all the artwork in your Expression Design document as brush resources in a resource dictionary.
Selected objects Select this option to export only those objects that you selected before you opened the Export dialog box.
Slices Select this option to export slices of your artwork, in multiple output files and formats. Slices are configured before you open the Export dialog box. The preview window changes to display each slice individually so that you can select different export settings for each. You can also use the Slice contents drop-down box to show or hide objects in the slice. For more information, see Working with slices.
In the Export dialog box, in the Format list, select one of the following:
XAML WPF Resource Dictionary Select this option if you are exporting the whole document or selected objects. You can then set the Group by property to export one resource per layer (Layers), one resource per top-level object (Objects), or one resource for the whole document or selected objects (Document). For example, if each layer in your document represents a button in a future Expression Blend project, select Layers.
XAML WPF Drawing Brush If you are exporting slices, select this option for each slice. You can set the Format property for multiple slices by using the SHIFT key to select multiple slices before you set the Format property.
Expression Design does not assume that you want to create a drawing brush resource for each slice. For example, you could export a slice in PNG format, and export the PNG file in a XAML WPF resource dictionary container. The PNG file is exported in a subfolder in the same directory as your exported resource dictionary file, and the PNG file is referenced as an image brush resource instead of as a drawing brush resource. You can use image brush resources to paint objects in a Expression Blend project just like drawing brush resources.
You can then select the XAML WPF Resource Dictionary container from the list next to Container name, and enter a name for your resource dictionary in the Container name text box. If you do not select a container, each slice will be exported as a brush resource in its own individual resource dictionary.
Adjust the following settings for brush resources under Live effects:
If you are exporting slices as brush resources, you must set these properties on each slice.
Rasterize all Select this option to rasterize (convert into bitmapped images) any live effects that are applied to your artwork. This option helps maintain the appearance of your artwork as much as it can.
Convert to XAML effects Select this option to convert any live effects to XAML-supported effects. Live effects that are not supported in XAML are rasterized.
Next to File name, enter a name for your resource dictionary.
The File name field is not present if you are exporting slices because the names of the slices are used as the file names for the exported brush resources.
Next to Location, browse to or enter the path for the location where you want the output file to be saved.
Click Export All to export the file or files. If you are exporting slices and you want to export only some of them, you can select multiple slices in the preview window (hold the SHIFT key), click the drop-down arrow next to Export All, and then click Export Selected Slice(s). Alternatively, if you want to save any changes that you made to the export properties for individual slices without actually exporting the slices, click the drop-down arrow next to Export All and select Save Settings and Close.
Your resource dictionary is exported to the path that you specified in the Location property, together with any supporting artwork in a subfolder named <resource_name>_files. When you add the resource dictionary to a Expression Blend project, Expression Blend automatically imports the <resource_name>_files folder also.
To import your resource dictionary into an Expression Blend project
In an open WPF project in Expression Blend, click Add Existing Item on the Project menu.
In the Add Existing Item dialog box, browse to your exported XAML WPF resource dictionary file, select it, and then click Open. The file is added under Files in the Project panel. If the resource dictionary includes exported image files in a <resource_name>_files folder, that folder is imported also. All the drawing brush resources are displayed in the Resources panel, under the name of the resource dictionary.
Do one of the following to use an imported brush resource:
In the Resources panel, expand the name of your resource dictionary, and then drag a resource onto the artboard of an open document. A pop-up menu appears, which gives you the option to apply the resource as a brush property on an existing object on the artboard, or to create a new object (for example, a Rectangle), and apply the brush resource to the object's Fill property. You can also copy a drawing brush to the canvas to modify it in Expression Blend.
Under Objects and Timeline, select an object, and then, under Brushes in the Properties panel, click the Brush resources tab, and then select the name of the brush resource that you want to apply from the list that appears.
Under Objects and Timeline, select an object, and then, under Brushes in the Properties panel, click the Advanced property options button next to a brush property, click Local Resource, and then select the name of the brush resource that you want to apply.
For more information about how to apply resources, see the "Apply or remove a resource" topic in the Expression Blend User Guide.
Make sure that the names of your imported brush resources differ from resources elsewhere in your Expression Blend project. You can rename resource objects in the Resources panel by right-clicking the name and then selecting Rename.