Keybinding Command/Action

Oct 22, 2010 at 5:37 AM

I'm currently investigating this frame work and was wondering if it can handle the WPF Window.InputBindings -> KeyBinding Command/Action usage?

I've got a business requirement that the Escape key press closes the current view.

<KeyBinding Key="Escape" Command="{Binding CloseCommand}" />
Oct 22, 2010 at 1:21 PM

The short answer is yes. The longer answer: You can use any type of Interaction.TriggerBase to trigger Caliburn's Actions. We only support EventTrigger OOTB, so you could use that with and PreviewKeyUp event on the window itself and check the key in your method. But you could also find/create a custom Trigger that uses input bindings under the covers and lets you specify the key inline.

Oct 25, 2010 at 5:44 AM

What is OOTB?

I've not used Caliburn before now, could you privide an example of doing both of these as I'm not sure where to start to attempt this?

Oct 31, 2010 at 6:11 AM


<Window x:Class="Core.ShellView"
    cal:Message.Attach="[Event PreviewKeyUp] = [Action PreviewKeyUp($eventArgs)];"


public void PreviewKeyUp(KeyEventArgs e)
    switch (e.Key)
        case Key.Escape: MessageBox.Show("Escape was pressed"); break;

Apr 7, 2014 at 1:23 PM
Would this pattern work the same when using a UserControl and letting CM inject it into a window?