The help topic page on ComponentResourceKey doesn’t give great guidance on when you would want to move from a string-based key to a ComponentResourceKey for putting and/or retrieving resources from a ResourceDictionary. Does anybody have any insight on when you would want to use a ComponentResourceKey over a string?
The help topic page on ComponentResourceKey doesn’t give great guidance on when you would
Share
From what I understand about ComponentResourceKeys is that they establish global uniqueness by defining themselves with respect to a type, and are required for referencing resources defined in generic or theme dictionaries.
Resources you store in a theme dictionary (eg generic.xaml) are only accessible via ComponentResourceKey and not a normal x:Key UNLESS you explicitly reference the generic.xaml into the MergedDictionaries collection of a Resources collection (eg at the App or Window or element level) but you should not do this as this is not the intent of generic.xaml