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; }
member this.TabIndex : int with get, set
Public Property TabIndex As Integer
属性值
决定设备的逻辑导航顺序的值。A value that determines the order of logical navigation for a device. 默认值为 MaxValue。The 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 |
元数据属性设置为true Metadata properties set to true |
NoneNone |