简体   繁体   English

WPF控件中的标准键盘快捷键

[英]Standard keyboard shortcuts in WPF controls

I'm interested in a list of all available shortcuts of WPF controls. 我对WPF控件的所有可用快捷方式列表感兴趣。 I was mainly interested in the standard shortcuts for WPF TreeView control (eg, expand/collapse all, select all and so on), but I can't seem to find any location that lists them. 我主要对WPF TreeView控件的标准快捷方式感兴趣(例如,全部展开/折叠,全部选择等等),但似乎找不到列出它们的任何位置。 Is there a specific page listing available shortcuts for WPF controls? 是否有特定的页面列出了WPF控件的可用快捷方式?

I know some shortcuts are supported naively, eg, Ctrl + A will select all rows in a given ListView control. 我知道天真地支持某些快捷方式,例如Ctrl + A将选择给定ListView控件中的所有行。

I could define my own shortcuts and implement their behaviour. 我可以定义自己的快捷方式并实现其行为。 However, I feel it is not a good practice to define shortcuts that are already supported by the .NET framework and hence the need to know about such supported shortcuts. 但是,我认为定义.NET框架已支持的快捷方式不是一个好习惯,因此需要了解此类支持的快捷方式。

In other situations I would typically use the same shortcuts available in Visual Studio as it is a WPF application, but I am hopping here for a more extensive list of out of the box supported shortcuts in WPF controls. 在其他情况下,我通常会使用Visual Studio中与WPF应用程序相同的快捷方式,但是我希望在这里获得WPF控件中开箱即用支持的快捷方式的更详细列表。

Thanks to psoshmo for pointing to the MSDN article. 感谢psoshmo指向MSDN文章。 It'd be nice if they were all listed out so you didn't have to comb through a bunch of links to figure it out. 如果它们全部都列出来,那就太好了,所以您不必梳理一堆链接就可以找出答案。 So here they are. 所以他们在这里。 This is not all the commands, just the once with default key bindings. 这不是全部命令,只有一次具有默认键绑定。

  • Application Commands: ApplicationCommands 应用程序命令: ApplicationCommands

    • ContextMenu: Shift+F10 快捷菜单: Shift + F10
    • Copy: Ctrl+C || 复制: Ctrl + C || Ctrl+Insert 按Ctrl +插入
    • Cut: Ctrl+X || 剪切: Ctrl + X || Shift+Delete Shift + Delete键
    • Delete: Del 删除: 德尔
    • Find: Ctrl+F 查找: Ctrl + F
    • Help: F1 帮助: F1
    • New: Ctrl+N 新增: Ctrl + N
    • Open: Ctrl+O 打开: Ctrl + O
    • Paste: Ctrl+V || 粘贴: Ctrl + V || Shift+Insert Shift + Insert键
    • Print: Ctrl+P 打印: Ctrl + P
    • PrintPreview: Ctrl+F2 打印预览: Ctrl + F2
    • Properties: F4 属性: F4
    • Redo: Ctrl+Y 重做: Ctrl + Y
    • Replace: Ctrl+H 替换: Ctrl + H
    • Save: Ctrl+S 保存: Ctrl + S
    • SelectAll: Ctrl+A 全选: Ctrl + A
    • Stop: Esc 停止: Esc
    • Undo: Ctrl-Z 撤消: Ctrl-Z
  • Navigation Commands: NavigationCommands 导航命令: NavigationCommands

    • BrowseBack: Alt+Left 浏览返回: Alt +左
    • BrowseForward: Alt+Right 浏览前进: Alt +右键
    • BrowseHome: Alt+Home BrowseHome: Alt + Home
    • BrowseStop: Alt+Esc BrowseStop: Alt + Esc
    • Favorites: Ctrl+I 收藏夹: Ctrl + I
    • Refresh: F5 刷新: F5
    • Search: F3 搜索: F3
  • Media Commands: MediaCommands 媒体命令: MediaCommands

    • None 没有
  • Component Commands: ComponentCommands 组件命令: ComponentCommands

    • ExtendSelectionDown: Shift+Down ExtendSelectionDown: Shift + Down
    • ExtendSelectionLeft: Shift+Left ExtendSelectionLeft: Shift +左键
    • ExtendSelectionRight: Shift+Right ExtendSelectionRight: Shift + Right
    • ExtendSelectionUp: Shift+Up ExtendSelectionUp: Shift +向上键
    • MoveDown: Down 下移下移
    • MoveFocusBack: Ctrl+Left MoveFocusBack: Ctrl +向左键
    • MoveFocusDown: Ctrl+Down MoveFocusDown: Ctrl +向下键
    • MoveFocusForward: Ctrl+Right MoveFocusForward: Ctrl +向右键
    • MoveFocusPageDown: Ctrl+PageDown MoveFocusPageDown: Ctrl + PageDown
    • MoveFocusPageUp: Ctrl+PageUp MoveFocusPageUp: Ctrl + PageUp
    • MoveFocusUp: Ctrl+Up MoveFocusUp: Ctrl +向上键
    • MoveLeft: Left MoveLeft: 向左
    • MoveRight: Right 向右移动: 向右
    • MoveToEnd: End MoveToEnd: 结束
    • MoveToHome: Home MoveToHome: 主页
    • MoveToPageDown: PageDown MoveToPageDown: PageDown
    • MoveToPageUp: PageUp MoveToPageUp: PageUp
    • MoveUp: Up 上移: 上移
    • ScrollPageDown: PageDown ScrollPageDown: PageDown
    • ScrollPageUp: PageUp ScrollPageUp: PageUp
    • SelectToEnd: Shift+End SelectToEnd: Shift + End
    • SelectToHome: Shift+Home SelectToHome: Shift + Home
    • SelectToPageDown: Shift+PageDown SelectToPageDown: Shift + PageDown
    • SelectToPageUp: Shift+PageUp SelectToPageUp: Shift + PageUp
  • Editing Commands: EditingCommands 编辑命令: EditingCommands

    • AlignCenter: Ctrl+E AlignCenter: Ctrl + E
    • AlignJustify: Ctrl+J AlignJustify: Ctrl + J
    • AlignLeft: Ctrl+L 左对齐: Ctrl + L
    • AlignRight: Ctrl+R 右对齐: Ctrl + R
    • Backspace: Backspace 退格键: 退格键
    • DecreaseFontSize: Ctrl+OemOpenBrackets DecreaseFontSize: Ctrl + OemOpenBrackets
    • DecreaseIndentation: Ctrl+Shift+T 减少缩进: Ctrl + Shift + T
    • Delete: Delete 删除: 删除
    • DeleteNextWord: Ctrl+Delete DeleteNextWord: Ctrl + Delete
    • DeletePreviousWord: Ctrl+Backspace DeletePreviousWord: Ctrl + Backspace
    • EnterLineBreak: Shift+Enter EnterLineBreak: Shift + Enter
    • EnterParagraphBreak: Enter EnterParagraphBreak: 输入
    • IncreaseFontSize: Ctrl+OemCloseBrackets 增加字体大小Ctrl + OemCloseBrackets
    • IncreaseIndentation: Ctrl+T 增加缩进: Ctrl + T
    • MoveDownByLine: Down MoveDownByLine: 向下
    • MoveDownByPage: PageDown MoveDownByPage: PageDown
    • MoveDownByParagraph: Ctrl+Down MoveDownByParagraph: Ctrl +向下键
    • MoveLeftByCharacter: Left MoveLeftByCharacter: 向左
    • MoveLeftByWord: Ctrl+Left MoveLeftByWord: Ctrl +左键
    • MoveRightByCharacter: Right MoveRightByCharacter:
    • MoveRightByWord: Ctrl+Right MoveRightByWord: Ctrl +向右键
    • MoveToDocumentEnd: Ctrl+End MoveToDocumentEnd: Ctrl + End
    • MoveToDocumentStart: Ctrl+Home MoveToDocumentStart: Ctrl + Home
    • MoveToLineEnd: End MoveToLineEnd: 结束
    • MoveToLineStart: Home MoveToLineStart: 主页
    • MoveUpByLine: Up MoveUpByLine: 向上
    • MoveUpByPage: PageUp MoveUpByPage: PageUp
    • MoveUpByParagraph: Ctrl+Up MoveUpByParagraph: Ctrl +向上键
    • SelectDownByLine: Shift+Down SelectDownByLine: Shift + Down
    • SelectDownByPage: Shift+PageDown SelectDownByPage: Shift + PageDown
    • SelectDownByParagraph: Ctrl+Shift+Down SelectDownByParagraph: Ctrl + Shift +向下键
    • SelectLeftByCharacter: Shift+Left SelectLeftByCharacter: Shift +左键
    • SelectLeftByWord: Ctrl+Shift+Left SelectLeftByWord: Ctrl + Shift +左键
    • SelectRightByCharacter: Shift+Right SelectRightByCharacter: Shift +向右
    • SelectRightByWord: Ctrl+Shift+Right SelectRightByWord: Ctrl + Shift +向右键
    • SelectToDocumentEnd: Ctrl+Shift+End SelectToDocumentEnd: Ctrl + Shift + End
    • SelectToDocumentStart: Ctrl+Shift+Home SelectToDocumentStart: Ctrl + Shift + Home
    • SelectToLineEnd: Shift+End SelectToLineEnd: Shift + End
    • SelectToLineStart: Shift+Home SelectToLineStart: Shift + Home
    • SelectUpByLine: Shift+Up SelectUpByLine: Shift +向上键
    • SelectUpByPage: Shift+PageUp SelectUpByPage: Shift + PageUp
    • SelectUpByParagraph: Ctrl+Shift+Up SelectUpByParagraph: Ctrl + Shift +向上键
    • TabBackward: Shift+Tab TabBackward: Shift + Tab
    • TabForward: Tab TabForward: 制表符
    • ToggleBold: Ctrl+B ToggleBold: Ctrl + B
    • ToggleBullets: Ctrl+Shift+L ToggleBullets: Ctrl + Shift + L
    • ToggleInsert: Insert ToggleInsert: 插入
    • ToggleItalic: Ctrl+I ToggleItalic: Ctrl + I
    • ToggleNumbering: Ctrl+Shift+N 切换编号: Ctrl + Shift + N
    • ToggleSubscript: Ctrl+OemPlus 切换下标: Ctrl + OemPlus
    • ToggleSuperscript: Ctrl+Shift+OemPlus ToggleSuperscript: Ctrl + Shift + OemPlus
    • ToggleUnderline: Ctrl+U ToggleUnderline: Ctrl + U

Update 2016-01-12: I missed the Editing Commands as they are referenced in another place. 更新2016-01-12:我错过了编辑命令,因为它们在另一个地方被引用。 The article for them also lists out the default key bindings, which can be found here . 针对它们的文章还列出了默认的键绑定,可以在此处找到。

Update 2018-04-16: Added Editing Commands and added links. 更新2018-04-16:添加了编辑命令并添加了链接。

As far as I know, there is no master list of supported shortcuts, and you are right that they in general will inherit their shortcuts from the basic shortcuts in Windows. 据我所知,尚没有受支持的快捷方式的主列表,您是正确的,他们通常会从Windows中的基本快捷方式继承其快捷方式。 I have searched for this on my own before and have never been able to locate a list. 我以前曾经自己搜索过此文件,但从未找到过列表。 Others I have seen asking on the internet have also never had any luck. 我在网上看到的其他人也从未有过运气。

So the unfortunate answer is: No, there is no list. 因此,不幸的答案是:不,没有清单。

EDIT: OK, after some digging, the best I can give you is a list of pre-defined commands that you can apply to your controls that are built into WPF. 编辑:好的,经过一番挖掘,我能提供给您的是最好的预定义命令列表,您可以将它们应用于WPF中内置的控件。 These come in five categories: 这些分为五类:

  • Application Commands 应用命令
  • Navigation Commands 导航命令
  • Component Commands 组件命令
  • Media Commands 媒体命令
  • Editing Commands 编辑命令

Their documentation can be found on MSDN here (an example). 他们的文档可以在MSDN上找到 (示例)。 Clicking on one of the commands will take you to its individual page which will list their default shortcut like this as its "Key Gesture" property. 点击其中一个命令将带您到其个人网页,其中将列出它们的默认快捷键像这样作为其“关键姿势”属性。

You can assign these default commands to controls like so: 您可以将这些默认命令分配给控件,如下所示:

  <Button Command="ApplicationCommands.Cut" CommandTarget="{Binding ElementName=txtEditor}" Width="60">_Cut</Button>
  <Button Command="ApplicationCommands.Paste" CommandTarget="{Binding ElementName=txtEditor}" Width="60" Margin="3,0">_Paste</Button>

This is a seemingly pretty basic tutorial on binding these commands to buttons and what not (where that code is from). 是一个看似非常基础的教程,内容涉及将这些命令绑定到按钮以及不绑定按钮(代码来自何处)。 This doesn't tell you what commands are there by default, but it should be able to at least deduce the keyboard shortcuts for some of these commands, for whatever that's worth. 并不能告诉您默认情况下有哪些命令,但是它应该至少能够推断出其中一些命令的键盘快捷键,无论它们值多少。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM