wpf - 选项卡控件上选项卡之间的键盘快捷方式

标签 wpf tabs

在使用 WPF 选项卡控件时,是否可以分配键盘快捷键以在控件中的选项卡之间移动?

或者,是否可以这样分配 tabIndex,当用户到达第一个选项卡中的最后一个字段并再次按下键盘 Tab 键时,下一个选项卡中的第一个控件获得焦点?

最佳答案

对于 future 的读者,我找到了 HowTo add an ALT+ shortcut key to a TabItem in WPF? 很有帮助(如果你想为每个选项卡分配一个 Alt+<key> 热键):

The following example should get you far enough to get you started. Basically, you need to create the Header using an Xml Element instead of the Attribute usage, and specify the AccessText, with the letter following the underscore specifying the hotkey to be assigned.

<Window x:Class="WpfApplication8.Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="Window1" Height="300" Width="300">
    <Grid>
        <TabControl>
            <TabItem>
                <TabItem.Header>
                    <AccessText Text="Tab_One"/>
                </TabItem.Header>
            </TabItem>
            <TabItem>
                <TabItem.Header>
                    <AccessText Text="Tab_Two"/>
                </TabItem.Header>
            </TabItem>
        </TabControl>
    </Grid>
</Window>

关于wpf - 选项卡控件上选项卡之间的键盘快捷方式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8096675/

相关文章:

c# - 当受影响的控件被隐藏时,WPF Storyboard动画是否继续运行?

c# - 绑定(bind)到数据网格的 ObservableCollection - 使用工厂方法

c# - WPF C# MVC/MVP 模式和用户控制代码隐藏

javascript - 双点击事件不起作用

javascript - 更改选项卡时如何从 activeElement 中移除焦点(onfocus/onblur)?

wpf - LargeChange 和 SmallChange 属性对 ProgressBar 控件有何作用?

c# - 如何解决 WPF 应用程序中的字体呈现问题?

android - ActionBar 选项卡高度

html - 如何删除所选选项卡的底部边框

android - 我如何在android中的选项卡式 Activity 中管理布局文件?