Searches for a resource with the specified key, and throws an exception if the requested resource is not found.
Assembly: PresentationFramework (in PresentationFramework.dll)
- Type: System.Object
The key identifier for the requested resource.
If you call this method for a key that cannot be found, an exception is thrown. If you do not want to handle exceptions that result from calling , call TryFindResource instead. TryFindResource returns null when a requested resource cannot be found, and does not throw an exception.
If the resource is not found on the calling element, the parent element in the logical tree is searched next, then the application, then themes, and finally system resources. This lookup methodology is identical to how the tree is searched if a resource were requested by a dynamic resource reference in markup. For more information about resource lookup, see Resources Overview.
Typically, you immediately cast a return value to the type of the property that you setting with the returned resource value.
Resource keys are not necessarily strings. For instance, styles for controls at the theme level are deliberately keyed to the Type of the control, and application or page styles for controls typically use this same key convention. For details, see Styling and Templating or Resources Overview.
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.