이 설명서는 보관되지만 유지 되지 않습니다.

FrameworkElement.FindName 메서드

Finds an element that has the provided identifier name.

네임스페이스: System.Windows
어셈블리: PresentationFramework(presentationframework.dll)

public Object FindName (
	string name
)
public Object FindName (
	String name
)
public function FindName (
	name : String
) : Object
XAML에서 메서드를 사용할 수 없습니다.

매개 변수

name

The name of the requested element.

반환 값

The requested element. This can be null 참조(Visual Basic의 경우 Nothing) 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 operates within the current element's namescope. For details, see WPF Namescopes.

This example describes how to use the FindName method to find an element by its Name value.

In this example, the method to find a particular element by its name is written as the event handler of a button. stackPanel is the Name of the root FrameworkElement being searched, and the example method then visually indicates the found element by casting it as TextBlock and changing one of the TextBlock visible UI properties.

void Find(object sender, RoutedEventArgs e)
{
    object wantedNode = stackPanel.FindName("dog");
    if (wantedNode is TextBlock)
    {
        // Following executed if Text element was found.
        TextBlock wantedChild = wantedNode as TextBlock;
        wantedChild.Foreground = Brushes.Blue;
    }
}

For the complete sample, see Searching for an Element Sample.

Microsoft .NET Framework 3.0은 Windows Vista, Microsoft Windows XP SP2 및 Windows Server 2003 SP1에서 지원됩니다.

.NET Framework

3.0에서 지원
표시: