Control.TabIndex 屬性

定義

取得或設定值,此值會決定當使用者使用 TAB 鍵巡覽控制項時,項目接收焦點的順序。Gets or sets a value that determines the order in which elements receive focus when the user navigates through controls by using the TAB key.

public:
 property int TabIndex { int get(); void set(int value); };
[System.ComponentModel.Bindable(true)]
public int TabIndex { get; set; }
[<System.ComponentModel.Bindable(true)>]
member this.TabIndex : int with get, set
Public Property TabIndex As Integer

屬性值

Int32

決定裝置邏輯巡覽順序的值。A value that determines the order of logical navigation for a device. 預設值是 MaxValueThe default value is MaxValue.

屬性

範例

下列範例會設定三個按鈕的索引標籤索引。The following example sets the tab index of three buttons.


<Button Name="btn9" BorderThickness="5.0" 
        Click="ChangeBorderThickness" TabIndex="2">
  BorderThickness
</Button>

<Button Name="btn10" FontStretch ="Condensed" 
        Click="ChangeFontStretch" TabIndex="3">
  FontStretch
</Button>

<Button Name="btn11" Padding = "5" 
        Click="ChangePadding" TabIndex="1">
  Padding
</Button>

備註

擁有較低標籤索引的控制項會在擁有較高索引的控制項之後取得焦點。A control with a lower tab index receives focus before a control with a higher index.

相依性屬性資訊Dependency Property Information

識別碼欄位Identifier field TabIndexProperty
中繼資料屬性設定為 trueMetadata properties set to true None

適用於