WPF如何使用键盘快捷键 [英] WPF How to Work with Keyboard shortcuts

查看:116
本文介绍了WPF如何使用键盘快捷键的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有10个按字母顺序排序的复选框项目,例如Apple,AirCraft,Ball,Bottom,Cat等。按 A 键盘焦点必须设置为 Apple 复选框, B Ball 。由于项目源计数,这些复选框项目是动态可变的。 Thanx提前。

I have 10 check box items sorted Alphabetically ,say for example ,Apple,AirCraft,Ball,Bottom,Cat etc..by pressing A through keyboard focus must be set to Apple check box,B to Ball . These Checkbox Items are dynamically variable due to Item source count. Thanx in advance.

推荐答案

在文本中使用下划线:''_ Apple'',''_ Ball'',''E_xample''
use underscore in text: ''_Apple'', ''_Ball'', ''E_xample''

对所有人来说,我已经找到了这个问题的答案,它很容易遍历项目,



按< kbd> A< ; / KBD>密钥必须设置为** Apple **复选框,< kbd> B< / kbd> - **球**。由于项目来源计数,这些复选框项目是动态可变的。



如下所示,在<< b>A

1。 _Apple

2. _Apple1

3. _Apple2




如果我按< kbd> A< / KBD>以字母 A 开头的第一个项目将获得焦点并再次按下< kbd> A< / kbd>焦点设置为以字母 A 开头的下一个项目,如果它到达最后一个项目,则以字母 A 开始,然后再次按下< kbd> A< / kbd>它将转到第一个带有起始字母 A 的项目。如果你想勾选复选框,你可以使用< kbd> SpaceBar< / kbd> ;,如果复选框项必须是withtin ItemsControl。
Thanx for all, I have found answer to this question by myself, its ver very simple to traverse Items ,

By pressing the <kbd>A</kbd> key the focus must be set to the **Apple** check box, <kbd>B</kbd> - to **Ball**. These check box items are dynamically variable due to item source count.

Jus do it as below, place underscore symbol "_" before "A"
1. _Apple
2. _Apple1
3. _Apple2


If i Press <kbd>A</kbd> first item that starts with letter A will get Focus and again Pressing <kbd>A</kbd> Focus set to next Item that starts with letter A, if it reaches the last item starts with letter A then again if i press <kbd>A</kbd> it will goto the first item that has starting letter A. If u want to check the checkbox u can use <kbd>SpaceBar</kbd>, provided checkbox items must be withtin ItemsControl.


这篇关于WPF如何使用键盘快捷键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆