Assembly: PresentationFramework (in presentationframework.dll)
The key identifier for the requested resource.
Return ValueThe requested resource. If no resource with the provided key was found, an exception is raised. An UnsetValue value might also be returned in the exception case.
If you call this method for a key that cannot be found, an exception is raised. If you do not want to handle exceptions that result from calling FindResource, call TryFindResource instead. TryFindResource returns a null reference (Nothing in Visual Basic) when a requested resource cannot be found, and does not raise 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 FindResource 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 Styles Overview or Resources Overview.
Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter EditionThe Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.