FrameworkElementExtensions.TryFindResource Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
TryFindResource(FrameworkElement, Object) |
Provides a WPF compatible version of TryFindResource to provide a static resource lookup. If the key is not found in the current element's resources, the logical tree is then searched element-by-element to look for the resource in each element's resources. If none of the elements contain the resource, the Application's resources are then searched. See: https://docs.microsoft.com/dotnet/api/system.windows.frameworkelement.tryfindresource. |
TryFindResource(FrameworkElement, Object, Object) |
Provides a WPF compatible version of TryFindResource to provide a static resource lookup. If the key is not found in the current element's resources, the logical tree is then searched element-by-element to look for the resource in each element's resources. If none of the elements contain the resource, the Application's resources are then searched. See: https://docs.microsoft.com/dotnet/api/system.windows.frameworkelement.tryfindresource. |
TryFindResource(FrameworkElement, Object)
Provides a WPF compatible version of TryFindResource to provide a static resource lookup. If the key is not found in the current element's resources, the logical tree is then searched element-by-element to look for the resource in each element's resources. If none of the elements contain the resource, the Application's resources are then searched.
See: https://docs.microsoft.com/dotnet/api/system.windows.frameworkelement.tryfindresource.
public static object? TryFindResource (this Windows.UI.Xaml.FrameworkElement element, object resourceKey);
static member TryFindResource : Windows.UI.Xaml.FrameworkElement * obj -> obj
<Extension()>
Public Function TryFindResource (element As FrameworkElement, resourceKey As Object) As Object
Parameters
- element
- Windows.UI.Xaml.FrameworkElement
The Windows.UI.Xaml.FrameworkElement to start searching for the target resource.
- resourceKey
- Object
The resource key to search for.
Returns
The requested resource, or null
if it wasn't found.
Applies to
TryFindResource(FrameworkElement, Object, Object)
Provides a WPF compatible version of TryFindResource to provide a static resource lookup. If the key is not found in the current element's resources, the logical tree is then searched element-by-element to look for the resource in each element's resources. If none of the elements contain the resource, the Application's resources are then searched.
See: https://docs.microsoft.com/dotnet/api/system.windows.frameworkelement.tryfindresource.
public static bool TryFindResource (this Windows.UI.Xaml.FrameworkElement element, object resourceKey, out object? value);
static member TryFindResource : Windows.UI.Xaml.FrameworkElement * obj * obj -> bool
<Extension()>
Public Function TryFindResource (element As FrameworkElement, resourceKey As Object, ByRef value As Object) As Boolean
Parameters
- element
- Windows.UI.Xaml.FrameworkElement
The Windows.UI.Xaml.FrameworkElement to start searching for the target resource.
- resourceKey
- Object
The resource key to search for.
- value
- Object
The resulting value, if present.
Returns
Whether or not a value with the specified key has been found.