Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Shared resources in a WPF application are typically defined in a ResourceDictionary and can be located in various places depending on how they were added to the application.

Here are some common locations:

  1. If the resources were defined in a standalone XAML file, they would likely be located in the application's directory, in a subfolder called "Resources", or in a folder named after the theme that the resources are for.

  2. If the resources were defined in a resource dictionary within the application, they would likely be located in the App.xaml file, which is in the root of the WPF project.

  3. If the resources were defined in a resource dictionary within a control or window, they would be located in that XAML file.

To access a shared resource defined in a ResourceDictionary in code, you can use the FindResource method on the resource's key. For example:

var myBrush = (Brush)FindResource("MyBrushKey");