TraversalRequest 類別

定義

表示將焦點移至另一個控制項的要求。Represents a request to move focus to another control.

public ref class TraversalRequest
[System.Serializable]
public class TraversalRequest
type TraversalRequest = class
Public Class TraversalRequest
繼承
TraversalRequest
屬性

範例

下列範例會建立TraversalRequest實例作為FrameworkElement.MoveFocus呼叫的輸入。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

備註

這個類別是用來做為UIElement.MoveFocus方法的輸入參數。This class is used as an input parameter for the UIElement.MoveFocus method. 方法具有 WPF 架構層級覆寫, 可提供更實際的實作為FrameworkElement.MoveFocus(), 以及和FrameworkContentElementContentElement的平行執行。 MoveFocusThe 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. 您通常會在上TraversalRequest設定屬性, 以便在您要求將焦點移至另一個專案時, 自訂焦點行為。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:

建構函式

TraversalRequest(FocusNavigationDirection)

初始化 TraversalRequest 類別的新執行個體。Initializes a new instance of the TraversalRequest class.

屬性

FocusNavigationDirection

取得周遊方向。Gets the traversal direction.

Wrapped

取得或設定值,這個值指出焦點周遊是否已到達能夠擁有焦點之子項目的結尾。Gets or sets a value that indicates whether focus traversal has reached the end of child elements that can have focus.

方法

Equals(Object)

判斷指定的物件是否等於目前的物件。Determines whether the specified object is equal to the current object.

(繼承來源 Object)
GetHashCode()

作為預設雜湊函數。Serves as the default hash function.

(繼承來源 Object)
GetType()

取得目前執行個體的 TypeGets the Type of the current instance.

(繼承來源 Object)
MemberwiseClone()

建立目前 Object 的淺層複製。Creates a shallow copy of the current Object.

(繼承來源 Object)
ToString()

傳回代表目前物件的字串。Returns a string that represents the current object.

(繼承來源 Object)

適用於

另請參閱