FocusManager.TryMoveFocus Method

Definition

Overloads

TryMoveFocus(FocusNavigationDirection)

Attempts to change focus from the element with focus to the next focusable element in the specified direction.

TryMoveFocus(FocusNavigationDirection, FindNextElementOptions)

Attempts to change focus from the element with focus to the next focusable element in the specified direction, using the specified navigation options.

TryMoveFocus(FocusNavigationDirection)

Attempts to change focus from the element with focus to the next focusable element in the specified direction.

public:
 static bool TryMoveFocus(FocusNavigationDirection focusNavigationDirection);
/// [Windows.Foundation.Metadata.Overload("TryMoveFocus")]
 static bool TryMoveFocus(FocusNavigationDirection const& focusNavigationDirection);
[Windows.Foundation.Metadata.Overload("TryMoveFocus")]
public static bool TryMoveFocus(FocusNavigationDirection focusNavigationDirection);
function tryMoveFocus(focusNavigationDirection)
Public Shared Function TryMoveFocus (focusNavigationDirection As FocusNavigationDirection) As Boolean

Parameters

focusNavigationDirection
FocusNavigationDirection

The direction to traverse (in tab order).

Returns

Boolean

bool

true if focus moved; otherwise, false.

Attributes

Remarks

The tab order is the order in which a user moves from one control to another by pressing the Tab key (forward) or Shift+Tab (backward).

This method uses tab order sequence and behavior to traverse all focusable elements in the UI.

You can also use either the FindNextElement(FocusNavigationDirection, FindNextElementOptions) method or the FindNextElement(FocusNavigationDirection) method to programmatically move focus. These methods retrieve the element (as a DependencyObject) that will receive focus based on the specified navigation direction (directional navigation only, cannot be used to emulate tab navigation).

Note

We recommend using the FindNextElement method instead of FindNextFocusableElement because FindNextFocusableElement retrieves a UIElement, which returns null if the next focusable element is not a UIElement (such as a Hyperlink object).

See also

Applies to

TryMoveFocus(FocusNavigationDirection, FindNextElementOptions)

Attempts to change focus from the element with focus to the next focusable element in the specified direction, using the specified navigation options.

public:
 static bool TryMoveFocus(FocusNavigationDirection focusNavigationDirection, FindNextElementOptions ^ focusNavigationOptions);
/// [Windows.Foundation.Metadata.Overload("TryMoveFocusWithOptions")]
 static bool TryMoveFocus(FocusNavigationDirection const& focusNavigationDirection, FindNextElementOptions const& focusNavigationOptions);
[Windows.Foundation.Metadata.Overload("TryMoveFocusWithOptions")]
public static bool TryMoveFocus(FocusNavigationDirection focusNavigationDirection, FindNextElementOptions focusNavigationOptions);
function tryMoveFocus(focusNavigationDirection, focusNavigationOptions)
Public Shared Function TryMoveFocus (focusNavigationDirection As FocusNavigationDirection, focusNavigationOptions As FindNextElementOptions) As Boolean

Parameters

focusNavigationDirection
FocusNavigationDirection

The direction to traverse (in tab order).

focusNavigationOptions
FindNextElementOptions

The options to help identify the next element to receive focus with keyboard/controller/remote navigation.

Returns

Boolean

bool

true if focus moved; otherwise, false.

Attributes

Remarks

The tab order is the order in which a user moves from one control to another by pressing the Tab key (forward) or Shift+Tab (backward).

This method uses tab order sequence and behavior to traverse all focusable elements in the UI.

You can also use either the FindNextElement(FocusNavigationDirection, FindNextElementOptions) method or the FindNextElement(FocusNavigationDirection) method to programmatically move focus. These methods retrieve the element (as a DependencyObject) that will receive focus based on the specified navigation direction (directional navigation only, cannot be used to emulate tab navigation).

Note

We recommend using the FindNextElement method instead of FindNextFocusableElement because FindNextFocusableElement retrieves a UIElement, which returns null if the next focusable element is not a UIElement (such as a Hyperlink object).

See also

Applies to