TraversalRequest Class
Represents a request to move focus to another control.
Assembly: WindowsBase (in WindowsBase.dll)
This class is used as an input parameter for the UIElement.MoveFocus method. The MoveFocus method has a WPF framework-level override that provides a more practical implementation (FrameworkElement.MoveFocus), as well as a parallel implementation on ContentElement and FrameworkContentElement. You typically will set properties on TraversalRequest in order to customize the focusing behavior when you request that the focus be moved to another element.
This class is also used as input parameters for the following methods:
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); }
For the complete sample, see Manipulate Focus Programmatically Sample.
Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.