When building graphical user interfaces, you will often want to use a resource, such as a brush, to paint the background of controls. These resources can be defined in a single place and shared throughout the app.
Using resources and templates
Sharing resources
In Solution Explorer, double-click on the App.xaml file, as shown in the following screenshot:
![](https://static.packt-cdn.com/products/9781788398077/graphics/assets/fa6aa504-91b2-4340-8bba-b53e918489e8.png)
Add the following markup inside the existing <Application> element:
<Application.Resources>
<LinearGradientBrush x:Key="rainbow">
<GradientStop Color="Red" Offset="0" />
<GradientStop Color="Orange" Offset="0.1" />
<GradientStop Color="Yellow" Offset="0.3"...