FocusManager.GetFocusedElement(DependencyObject) 메서드

정의

지정된 포커스 범위 내에서 논리적 포커스가 있는 요소를 가져옵니다.

public:
 static System::Windows::IInputElement ^ GetFocusedElement(System::Windows::DependencyObject ^ element);
public static System.Windows.IInputElement GetFocusedElement (System.Windows.DependencyObject element);
static member GetFocusedElement : System.Windows.DependencyObject -> System.Windows.IInputElement
Public Shared Function GetFocusedElement (element As DependencyObject) As IInputElement

매개 변수

element
DependencyObject

포커스 범위인 요소입니다.

반환

지정된 포커스 범위 내에서 논리적 포커스가 있는 요소입니다.

예외

element이(가) null인 경우

예제

다음 예제에서는 를 사용하여 논리 포커스가 있는 요소를 설정하고 를 사용하여 SetFocusedElementGetFocusedElement논리적 포커스가 있는 요소를 가져옵니다.

// Sets the focused element in focusScope1
// focusScope1 is a StackPanel.
FocusManager.SetFocusedElement(focusScope1, button2);

// Gets the focused element for focusScope 1
IInputElement focusedElement = FocusManager.GetFocusedElement(focusScope1);
' Sets the focused element in focusScope1
' focusScope1 is a StackPanel.
FocusManager.SetFocusedElement(focusScope1, button2)

' Gets the focused element for focusScope 1
Dim focusedElement As IInputElement = FocusManager.GetFocusedElement(focusScope1)

설명

FocusedElement 특정 포커스 scope 대한 논리적 포커스가 있는 요소입니다. 포커스 scope 요소가 로 설정true되었습니다IsFocusScope. 이 개체에는 키보드 포커스가 있거나 없을 수 있습니다. 키보드 포커스는 키보드 입력을 수신하는 요소를 나타냅니다. 포커스, 키보드 포커스 및 논리적 포커스에 대한 자세한 내용은 입력 개요를 참조하세요.

가 포커스 scope 아닌 경우 element 이 메서드는 를 반환null합니다.

를 사용하여 SetFocusedElement지정된 포커스 scope 내에서 논리적 포커스가 있는 요소를 지정합니다.

적용 대상