#550 – Converting a Brush into a Resource in Blend

Once you spend some time creating a Brush in Blend, e.g. specifying the different colors in a gradient brush, it’s likely that you’ll want to use the same brush in several different spots in your user interface.  You could just copy/paste the definition of the brush in XAML.  But the easier way to reuse a brush is to convert it to a resource and then to reference the resource by name wherever you use it.

To start with, assume that we have a linear gradient brush defined for a Label control’s Background.

Start by clicking on the white square (Advanced Options) to the right of the brush-related property.

On the menu that comes up, select Convert to New Resource.

Specify a name for the new resource.

Notice that the XAML now defines the brush as a resource and then references it from the Label.

Advertisements

About Sean
Software developer in the Twin Cities area, passionate about software development and sailing.

4 Responses to #550 – Converting a Brush into a Resource in Blend

  1. Pingback: Dew Drop – May 3, 2012 (#1,319) | Alvin Ashcraft's Morning Dew

  2. Pingback: Converting a Brush into a Resource in Blend

  3. Pingback: #551 – Resources Are Listed under the Resources Tab in Blend « 2,000 Things You Should Know About WPF

  4. Pingback: #552 – Setting a Property to Use an Existing Resource « 2,000 Things You Should Know About WPF

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: