Whenever I create a new WPF application or WPF user control library, the AssemblyInfo.cs
file includes the following attribute:
[assembly: ThemeInfo
The WPF framework uses this attribute in control libraries as a convenient way to apply resources to controls.
Consider that Windows can be run with different UI themes (Aero is one such example). The WPF controls provided by Microsoft alter their appearance for different environment themes.
If your application requires this behaviour, then you can create different theme dictionaries the in the themes
folder of your control library project.
Even if you don't need multi-theme support, it is convenient to put resources in the generic.xaml
file so that they are accessible to controls in the assembly. Perhaps your element (control) is defined in a .cs
file without a .xaml
partial class, and you need somewhere to store the resources it needs, or (more likely) you have resources that will be shared between many WPF elements in the same project/assembly.
The attribute you're referring to here is metadata for the mapping of these resources.