Udostępnij za pośrednictwem


FocusHelper.MoveFocusInto(UIElement) Method

Definition

Uses the UIElement.MoveFocus method to try to move WPF focus to the first valid focusable element inside the given UIElement, after first ensuring that WPF will not attempt to change focus because of a cross-HwndSource focus change.

If UIElement.MoveFocus fails to move focus into the element, focus will be cleared by invoking Keyboard.ClearFocus to clear WPF focus, and by using SetFocus to focus the HWND of HwndSource containing the element.

public:
 static void MoveFocusInto(System::Windows::UIElement ^ element);
public static void MoveFocusInto (System.Windows.UIElement element);
static member MoveFocusInto : System.Windows.UIElement -> unit
Public Shared Sub MoveFocusInto (element As UIElement)

Parameters

element
UIElement

The element to move focus into.

Remarks

If MoveFocus fails to move focus into the element, focus will be cleared by invoking ClearFocus to clear WPF focus and using SetFocus to focus the HWND of the HwndSource containing the element.

Applies to