Add note about x:key conflict with explicit keys (#166)

* Update how-to-use-an-application-scope-resource-dictionary.md

* Update how-to-use-an-application-scope-resource-dictionary.md
This commit is contained in:
Andy De George
2021-01-15 12:23:49 -06:00
committed by GitHub
parent 701634d9a5
commit a856d83f28
@@ -38,6 +38,8 @@ This example shows how to define and use an application-scope custom resource di
There are two considerations to make when using <xref:System.Windows.Application.Resources%2A>. First, the dictionary *key* is an object, so you must use exactly the same object instance when both setting and getting a property value. (Note that the key is case-sensitive when using a string.) Second, the dictionary *value* is an object, so you will have to convert the value to the desired type when getting a property value.
Some resource types may automatically use a property defined by the type as an explicit key, such as the <xref:System.Windows.Style> and <xref:System.Windows.DataTemplate> types. This may override your `x:Key` value. To guarantee that your `x:Key` key is respected, declare it before the explicit key property. For more information, see [Styles, DataTemplates, and implicit keys](../advanced/xaml-resources-define.md#styles-datatemplates-and-implicit-keys).
## See also
- <xref:System.Windows.ResourceDictionary>