WPF应用添加快捷键

WPF应用添加快捷键

 

一些快捷键的操作,可以极大地方便了应用的操作。

目前我经常用的一些快捷键:
1、ESC:关闭窗体
2、Ctrl+N:新建
3、F2:编辑
3、Delete:删除
4、F5:刷新
5、Ctrl+S:保存

有些快捷键,适合针对窗体直接设置。

<Window.InputBindings>
    <KeyBinding Command="{Binding AddCommand}" Gesture="Ctrl+N" />
    <KeyBinding Command="{Binding SaveCommand}" Gesture="Ctrl+S" />
</Window.InputBindings>

有些快捷键,可以针对列表直接设置,这样的话,如果有多个列表,可以同时支持快捷键操作。

<ListBox.InputBindings>
    <KeyBinding Command="{Binding EditCommand}" Gesture="F2" />
    <KeyBinding Command="{Binding DeleteCommand}" Gesture="Delete" />
    <KeyBinding Command="{Binding RefreshCommand}" Gesture="F5" />
</ListBox.InputBindings>
 
 
 

posted on   漫思  阅读(36)  评论(0编辑  收藏  举报

相关博文:
阅读排行:
· 微软正式发布.NET 10 Preview 1:开启下一代开发框架新篇章
· C# 集成 DeepSeek 模型实现 AI 私有化(本地部署与 API 调用教程)
· DeepSeek R1 简明指南:架构、训练、本地部署及硬件要求
· 没有源码,如何修改代码逻辑?
· NetPad:一个.NET开源、跨平台的C#编辑器
历史上的今天:
2023-12-31 优雅的设计
2023-12-31 BBC 开源的声音可视化库
2019-12-31 React.Children的使用
2019-12-31 如何更改账户信息

导航

< 2025年2月 >
26 27 28 29 30 31 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 1
2 3 4 5 6 7 8
点击右上角即可分享
微信分享提示