Managing logical resources
There could be several types of logical resources in a single application, and placing them inside a single XAML file (for example, App.xaml
) will increase problems while maintaining them. To resolve this problem, you can separate the resources of different types into their own respective files and reference them in App.xaml
.
In this recipe, we will learn how to manage these logical resources with a simple example. Though this will be shown with a single file, you can create separate files and reference them.
Getting ready
Assuming that you have opened Visual Studio, now create a new WPF application project called CH07.ManagingLogicalResourceDemo
.
How to do it...
Follow these simple steps to create separate resource files and reference them in the application:
- As we want to create a separate resource file, we need to create a file of type
Resource Dictionary
. Inside theSolution Explorer
, right-click on the project node and create a new folder namedThemes
. - Now right...