You can retrieve resources in XAML or directly through code-behind: Resources in code - WPF - Microsoft Learn
In WPF, getting a resource by its key allows you to reuse objects like brushes, styles, and templates throughout your application. Resources are stored in a ResourceDictionary , where each item is identified by a unique key—typically a string, though object types can also be used. Key Methods to Retrieve Resources

