Share via


Create a resource (Blend for Visual Studio)

Whenever you create a new resource from an existing property, style, or template, the Create Resource dialog box allows you to define the resource at the application level, the document level, or the object level, which determines where you can use the resource. For example, if you define the resource at the object level, then the resource can only be applied to the object on which you created it. You can also choose to store the resource in a resource dictionary, which is a separate file that you can use again in another project.

To create a resource

  1. Create an object or select an object in the Objects and Timeline panel.

  2. In the Properties panel, click Advanced options JJ155039.12e06962-5d8a-480d-a837-e06b84c545bb(en-us,VS.110).png next to a property, and then click Convert to New Resource.

    The appropriate dialog box for creating a resource appears.

    The Create Brush Resource dialog that appears when creating a resource from a brush

    JJ155039.092a1fec-f5b5-427c-a51e-aae1f6a1eee2(en-us,VS.110).png

  3. Under Name (Key), enter a key name. This is the name by which other objects can reference the resource, thus applying the resource to themselves.

  4. Under Define in, select the option where you want the resource to be defined:

    • Application   Makes the resource available to any document in your application.

    • This document (Page: <no name>)   Makes the resource available only to the current document.

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

    • Resource dictionary   Defines the resource in a resource dictionary file that can be reused in other projects.

  5. Click OK to exit the dialog box, create the resource, and apply it to the object from which you created it.

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

    For more methods of applying a resource, see Apply or remove a resource (Blend for Visual Studio).