TraversalRequest(FocusNavigationDirection) Constructor
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Initializes a new instance of the TraversalRequest class.
public:
TraversalRequest(System::Windows::Input::FocusNavigationDirection focusNavigationDirection);
public TraversalRequest (System.Windows.Input.FocusNavigationDirection focusNavigationDirection);
new System.Windows.Input.TraversalRequest : System.Windows.Input.FocusNavigationDirection -> System.Windows.Input.TraversalRequest
Public Sub New (focusNavigationDirection As FocusNavigationDirection)
Parameters
- focusNavigationDirection
- FocusNavigationDirection
The intended direction of the focus traversal, as a value of the enumeration.
Examples
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);
}
' Creating a FocusNavigationDirection object and setting it to a
' local field that contains the direction selected.
Dim focusDirection As FocusNavigationDirection = _focusMoveValue
' MoveFocus takes a TraveralReqest as its argument.
Dim request As New TraversalRequest(focusDirection)
' Gets the element with keyboard focus.
Dim elementWithFocus As UIElement = TryCast(Keyboard.FocusedElement, UIElement)
' Change keyboard focus.
If elementWithFocus IsNot Nothing Then
elementWithFocus.MoveFocus(request)
End If
Applies to
See also
ทํางานร่วมกับเราใน GitHub
แหล่งที่มาสำหรับเนื้อหานี้สามารถพบได้บน GitHub ซึ่งคุณยังสามารถสร้างและตรวจสอบปัญหาและคำขอดึงข้อมูลได้ สำหรับข้อมูลเพิ่มเติม ให้ดูคู่มือผู้สนับสนุนของเรา