Edit

Share via


LogicalTree.TryFindResource(FrameworkElement, Object) Method

Definition

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. https://docs.microsoft.com/dotnet/api/system.windows.frameworkelement.tryfindresourcehttps://docs.microsoft.com/dotnet/desktop-wpf/fundamentals/xaml-resources-define#static-resource-lookup-behavior

public static object TryFindResource (this Windows.UI.Xaml.FrameworkElement start, object resourceKey);
static member TryFindResource : Windows.UI.Xaml.FrameworkElement * obj -> obj
<Extension()>
Public Function TryFindResource (start As FrameworkElement, resourceKey As Object) As Object

Parameters

start
Windows.UI.Xaml.FrameworkElement

Windows.UI.Xaml.FrameworkElement to start searching for Resource.

resourceKey
Object

Key to search for.

Returns

Requested resource or null.

Applies to