Ctrl+z

Dec 29, 2010 at 3:05 PM

Hi!

I’m trying to implement Ctrl+z (undo) but I’m not sure how to make it work with Caliburn. It seems like the full Caliburn framework have some support for the Command Pattern, is this also true for Caliburn Micro? Shall I use ICommand or does Actions have some inherit support for Command Pattern? Perhaps I should use the Memento Pattern instead?

I’m a bit lost where to start and most of the resources I’ve found are not adapted to MVVM.

Thanx
/Mike

Coordinator
Dec 29, 2010 at 3:16 PM

Caliburn.Micro's Actions functionality is built on top of the System.Windows.Interaction Triggers. So, you can create (or find) a trigger (inherited from TriggerBase) that will respond to Ctrl+z by sending the ActionMessage. I think there are some other posts in the forums with examples.

Dec 30, 2010 at 2:05 PM

Fast answer, excellent :)

Hm, I'm not sure we talk about the same things. I have no problem with the KeyDown event Ctrl+z but rather the functionality that is usually associated with this key combination. Usually it seems like people create an ICommand for all Commands and store them in a stack but I’m not sure if I can do this with ActionMessages.

Thanx
/Mike

Coordinator
Dec 30, 2010 at 2:16 PM

Ok. I understand. Yes, you should use the Memento Pattern. You might even want to look into using something like this http://undo.codeplex.com/

Jan 3, 2011 at 3:20 PM

The undo framework is undoubtedly interesting. I might be able to use it as it is or at least get a clue to how undo could be implemented. I also have a feeling that I can use it to handle my dirty aware function, maybe.

 

Thanx
/Mike