- 2 minutes to read
[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]
When you create a Brush for an element, you enhance its reusability by factoring it into a ResourceDictionary. Use the Properties window to extract resources into reusable XAML.
From the Toolbox, drag a TextBlock control onto the Window.
Create a brush for the Background property. For more information, see How to: Create a Brush by Using the Brush Editor.
At the top of the Properties window, click the Alphabetical button.
Scroll to the Background property.
At the edge of the left column, click the Local property marker local ().
A menu appears.
You can also right-click the row to display the menu.
Click Extract Value to Resource.
The Create Resource dialog box appears.
In the Key text box, type BackgroundBrush.
A resource named BackgroundBrush is added to the parent control's resource dictionary, and the StaticResource markup extension is assigned to the TextBlock control's Background property.
In XAML view, find the BackgroundBrush resource.
How to: Create a Brush by Using the Brush Editor
StaticResource Markup Extension
Working with the WPF Designer