TraversalRequest Constructor (FocusNavigationDirection)

 

Initializes a new instance of the TraversalRequest class.

Namespace:   System.Windows.Input
Assembly:  WindowsBase (in WindowsBase.dll)

public TraversalRequest(
	FocusNavigationDirection focusNavigationDirection
)

Parameters

focusNavigationDirection
Type: System.Windows.Input.FocusNavigationDirection

The intended direction of the focus traversal, as a value of the enumeration.

The following example creates a TraversalRequest instance as input for a FrameworkElement.MoveFocus call.

// Creating a FocusNavigationDirection object and setting it to a
// local field that contains the direction selected.
FocusNavigationDirection focusDirection = _focusMoveValue;

// MoveFocus takes a TraveralReqest as its argument.
TraversalRequest request = new TraversalRequest(focusDirection);

// Gets the element with keyboard focus.
UIElement elementWithFocus = Keyboard.FocusedElement as UIElement;

// Change keyboard focus.
if (elementWithFocus != null)
{
    elementWithFocus.MoveFocus(request);
}

.NET Framework
Available since 3.0
Return to top
Show: