NameScope.FindName(String) 方法

定义

根据提供的名称字符串,返回由此 NameScope 保留的 XAML 名称范围中的相应对象。Returns the corresponding object in the XAML namescope maintained by this NameScope, based on a provided name string.

public:
 virtual System::Object ^ FindName(System::String ^ name);
public object FindName (string name);
abstract member FindName : string -> obj
override this.FindName : string -> obj
Public Function FindName (name As String) As Object

参数

name
String

要检索其对象部分的现有映射的名称部分。Name portion of an existing mapping to retrieve the object portion for.

返回

Object

name 映射的所请求对象。The requested object that is mapped with name. 如果提供的 namenull 或空字符串,或者未找到匹配的对象,则可返回 nullCan return null if name was provided as null or empty string, or if no matching object was found.

实现

注解

几个基本元素(FrameworkElementFrameworkElement)还公开了一个具有相同功能的 FindName 方法。Several base elements (FrameworkElement, FrameworkElement) also expose a FindName method with identical functionality. 基元素版本在常规逻辑树中执行 XAML 范围搜索,并向根元素进行操作。The base element versions perform a XAML namescope search within the conventional logical tree, working towards the root element. 确定 XAML 名称范围后,将查询该 XAML 名称范围以获取请求的名称。Once the XAML namescope is determined, that XAML namescope is queried for the requested name.

适用于

另请参阅