FrameworkElement.FindName(String) 方法

定义

查找具有提供的标识符名的元素。Finds an element that has the provided identifier name.

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

参数

name
String

所请求元素的名称。The name of the requested element.

返回

请求的元素。The requested element. 如果找不到匹配的元素,该值将为 nullThis can be null if no matching element was found.

注解

如果元素包含子元素,则会以递归方式搜索所请求的命名元素的子元素。If the element has child elements, these child elements are all searched recursively for the requested named element.

FindName 在当前元素的名称范围内运行。FindName operates within the current element's namescope. 有关详细信息,请参阅WPF XAML 名称范围For details, see WPF XAML Namescopes.

适用于

另请参阅