0
我目前正在使用Caliburn.Micro在WPF项目上工作,并且想要将KeyDown
事件绑定到UserControl
。如果打开Window
并且用户按下任何按钮,则应该触发它。KeyDown事件绑定到用户控件
<UserControl x:Class="Test.Views.AppView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:cal="http://www.caliburnproject.org"
cal:Message.Attach="[Event KeyDown] = [TestMethod($executionContext)]" />
不幸的是,这段代码不起作用。是否可以绑定Event
到UserControl
而不是像TextBox
或Button
这样的特定控件?
看看这个链接是否有帮助 - http://stackoverflow.com/questions/16719496/caliburn-micro-enter-key-event – Vinkal 2015-02-06 09:17:47