I'm currently working on a WPF project using Caliburn.Micro and want to bind a KeyDown
event to a UserControl
. It should be fired if the Window
is opened and the user pushes any button.
<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)]" />
Unfortunately this code doesn't work. Is it even possible to bind an Event
to the UserControl
and not to specific controls like TextBox
or Button
?