i just curious why when i access most controls via x:Name, for resources i do so using x:Key + i cannot access it from code (could using this.Resources["keyName"])
i just curious why when i access most controls via x:Name , for resources
Share
You can access resources on any
FrameworkElementas long as the element contains any resources. If defined in your markup, it must have ax:Keyand cannot have ax:Name.If a Button contains the resource for example, you must access it from its
Resourcescollection.If you want to find a resource from an object, its parents or the application, use
FindResource()instead.I don’t understand your confusion.