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:
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"...