如何在 Caliburn.Micro 中绑定按键手势? [英] How can I bind key gestures in Caliburn.Micro?

查看:21
本文介绍了如何在 Caliburn.Micro 中绑定按键手势?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何让 Caliburn.Micro 将按键手势映射到 ViewModel 上的操作方法?

How can I get Caliburn.Micro to map a key gesture to an action method on my ViewModel?

例如,我想实现一个选项卡式界面,并且我希望我的 ShellViewModel 有一个 NewTab 方法,用户应该能够通过按键盘上的 Ctrl+T 来调用该方法.

For example, I want to implement a tabbed interface, and I want my ShellViewModel to have a NewTab method, which the user should to be able to invoke by pressing Ctrl+T on the keyboard.

我知道完整的 Caliburn 框架支持手势,但我如何使用 Caliburn.Micro 做到这一点?是否有某种方法可以将操作绑定到 RoutedCommand(因为 RoutedCommands 已经支持输入手势)?或者通过其他方式获得手势支持?

I know that the full Caliburn framework has support for gestures, but how can I do this using Caliburn.Micro? Is there perhaps some way to bind an action to a RoutedCommand (since RoutedCommands already support input gestures)? Or some other way to get gesture support?

推荐答案

您可以通过派生 System.Windows.Interactivity.TriggerBase 来实现.这里是一个例子.

You can do it by deriving from System.Windows.Interactivity.TriggerBase. Here is an example.

这篇关于如何在 Caliburn.Micro 中绑定按键手势?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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