表格控件 Spread WPF-Silverlight 中自定义用户快捷键行为

表格控件 Spread WPF-Silverlight 本身内置了丰富的快捷键行为,用户可以同这些快捷键实现单元格选择,数据输入等行为,内置的快捷键如下表所示。

发布于 2013/05/07 00:00

表格控件 Spread WPF-Silverlight 本身内置了丰富的快捷键行为,用户可以同这些快捷键实现单元格选择,数据输入等行为,内置的快捷键如下表所示。

Key Action Action Name
Ctrl + Z Cancels the last user operation.

Undo

Ctrl + Y Repeats the last user operation.

Redo

Ctrl + Down Arrow Moves the active cell to the last row.

NavigationBottom

Down Arrow Moves the active cell down one cell.

NavigationDown

End Moves the active cell to the end of the row. NavigationEnd
Ctrl + Right Arrow Moves the active cell to the end of the row. NavigationEnd
Ctrl + Home Moves the active cell to the first cell in the control. NavigationFirst
Home Moves the active cell to the first cell in the row. NavigationHome
Ctrl + Left Arrow Moves the active cell to the first cell in the row. NavigationHome
Ctrl + End Moves the active cell to the last cell in the control. NavigationLast
Left Arrow Moves the active cell to the first cell in the row. NavigationLeft
Tab Moves the active cell right to the next cell and down to the first cell in the next row when the active cell is at the end of a row. CommitInputNavigationTabNext
Page Down Moves the active cell down to the next set of rows. NavigationPageDown
Ctrl + PageUp Moves to the previous sheet. NavigationPreviousSheet
PageUp Moves the active cell up to the next set of rows. NavigationPageUp
Shift + Tab Moves the active cell left and wraps to the end of the previous row when the active cell is the first cell in the row. CommitInputNavigationTabPrevious
Right Arrow Moves the active cell one cell to the right. NavigationRight
Up Arrow Moves the active cell up a cell. NavigationUp
Ctrl + Up Arrow Moves the active cell to the first cell in the column. NavigationTop
Delete Clears the data in the cell if it is not in edit mode. Clear
Backspace Clears the cell data if the cell is not in edit mode or moves a character to the left if the cell is in edit mode. ClearAndEditing
Enter Moves the active cell down a cell and takes the cell out of edit mode. CommitInputNavigationDown
Shift + Enter Moves the active cell up a cell and takes the cell out of edit mode. CommitInputNavigationUp
Escape Removes the current typed characters if the cell is in edit mode. CancelInput
Shift + Left Arrow Extends the selection one cell to the left of the active cell if the cell is not in edit mode (selects characters if the cell is in edit mode). SelectionLeft
Shift + Right Arrow Extends the selection one cell to the right of the active cell if the cell is not in edit mode (selects characters if the cell is in edit mode). SelectionRight
Shift + Up Arrow Extends the selection up one cell from the active cell if the cell is not in edit mode (selects cell characters if the cell is in edit mode). SelectionUp
Shift + Down Arrow Extends the selection down one cell from the active cell if the cell is not in edit mode (selects cell characters if the cell is in edit mode).. SelectionDown
Shift + Home Extends the selection from the active cell to the first cell in the row (selects cell characters if the cell is in edit mode). SelectionHome
Shift + Ctrl + Left Arrow Extends the selection from the active cell to the first cell in the row. SelectionHome
Shift + End Extends the selection from the active cell to the last cell in the row. SelectionEnd
Shift + Ctrl + Right Arrow Extends the selection from the active cell to the last cell in the row. SelectionEnd
Shift + Page Up Extends the selection one page up from the active cell. SelectionPageUp
Shift + Page Down Extends the selection one page down from the active cell. SelectionPageDown
Shift + Ctrl + Up Arrow Extends the selection from the active cell up to the first cell in the column. SelectionTop
Shift + Ctrl + Down Arrow Extends the selection from the active cell down to the last cell in the column. SelectionBottom
Shift + Ctrl + Home Extends the selection from the active cell to the first cell in the control. SelectionFirst
Shift + Ctrl + End Extends the selection from the active cell to the last cell in the control. SelectionLast
Ctrl + C Copies the selection to the Clipboard. Copy
Ctrl + X Cuts the selection to the Clipboard. Cut
Ctrl + V Pastes the data from the Clipboard. Paste
Alt + Enter Creates and moves to a new line if the cell is in edit mode. InputNewLine

但是,在运行Spread WPF-Silverlight应用程序时,我们会发现 Alt+Enter 键没用生效,其原因是在Silverlight中 Alt 键处理有些特别,所以,我们需要修改内置的快捷键行为来实现输入新行的功能,代码如下:

 

 

  1:     public MainPage()
  2:     {
  3:         InitializeComponent();
 
  5:         gcSpreadSheet1.View.KeyMap.Remove(new GrapeCity.Windows.SpreadSheet.UI.KeyStroke(Key.Enter,ModifierKeys.Alt));
  6:         gcSpreadSheet1.View.KeyMap.Add(new GrapeCity.Windows.SpreadSheet.UI.KeyStroke(Key.Enter, ModifierKeys.Control), SpreadActions.InputNewLine);
  7:     }

关于葡萄城

葡萄城是专业的软件开发技术和低代码平台提供商,以“赋能开发者”为使命,致力于通过表格控件、低代码和BI等各类软件开发工具和服务,一站式满足开发者需求,帮助企业提升开发效率并创新开发模式。葡萄城开发技术始于1980年,40余年来始终聚焦软件开发技术,有深厚的技术积累和丰富的产品线。是业界能够同时赋能软件开发和低代码开发的企业。凭借过硬的产品能力、活跃的用户社区和丰富的伙伴生态,与超过3000家合作伙伴紧密合作,产品广泛应用于信息和软件服务、制造、交通运输、建筑、金融、能源、教育、公共管理等支柱产业。

推荐相关案例
推荐相关资源
关注微信
葡萄城社区二维码

关注“葡萄城社区”

加微信获取技术资讯

加微信获取技术资讯

想了解更多信息,请联系我们, 随时掌握技术资源和产品动态