TraversalRequest(FocusNavigationDirection) 建構函式
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
初始化 TraversalRequest 類別的新執行個體。
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)
參數
- focusNavigationDirection
- FocusNavigationDirection
焦點周遊的預計方向,以列舉型別 (Enumeration) 的值表示。
範例
下列範例會 TraversalRequest 建立 實例作為呼叫的 FrameworkElement.MoveFocus 輸入。
// 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