Dealing with KeyCommand / InputBinding

May 2, 2011 at 3:42 PM
Edited May 2, 2011 at 3:43 PM

Hi All,

Since there is not an integrated facility to map from a KeyBinding ( ie Ctrl+S and so on :) ) I decided to write one. Here

http://www.felicepollano.com/2011/05/02/InputBindingKeyBindingWithCaliburnMicro.aspx

you'll find the implementation. Note since I'm new to Caliburn this can be naive... but is in place to discuss and try so...

May 2, 2011 at 4:10 PM

You could even provide a proper modification for the Message.Attach to support a short syntax

 <Button x:Name="Save" cm:Message.Attach="[Key Ctrl+S] = [Action Save]; [Event Click] = [Action Save]"/>
I suppose it could be quite useful! :)

May 2, 2011 at 4:14 PM
Edited May 2, 2011 at 4:16 PM

First, thanks for the feedback.

Yep but I need to modify the code base :) and, but may be I'm wrong, I can't properly choose what InputBinding collection to append to.

May 2, 2011 at 4:22 PM

You would just add a custom handling, the same way I added support for full Markup syntax using the provided extension points (check the Parser class). We could say that it is a scenario supported by the CM framework.

The InputBinding collection would be the one you are associating the message to. Note that Message.Attach is just a short syntax for the extended definition you are currently using.

May 2, 2011 at 5:25 PM

Good, maybe I'll try to fork and add. Thanks.