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.

傳回

Object

要求的項目。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.

適用於

另請參閱