RoutedUICommand and Cinch

Oct 21, 2011 at 10:27 PM

Just wondering if there is an example of how to use the RoutedUICommand with a Cinch ViewModel.  I have a ribbon control (ActiPro) that uses RoutedCommands called 'RibbonCommands' similar to the Microsoft ribbon.  I found something from Josh Smith (http://www.codeproject.com/KB/WPF/VMCommanding.aspx) that I plugged into my Cinch ViewModel and it works, but I would rather not have to implement another interface in my ViewModel if I can avoid it. Is there a pure Cinch solution?

Thanks,

Patrick Duffy

Coordinator
Oct 24, 2011 at 8:48 AM
Edited Oct 24, 2011 at 8:49 AM

There is not really a pure Cinch solution for this, you have 3 choices really

1. Use Joshs approach

2. Use Input Bindings which allow gestures to be applied, and bind to standard Cinch SimpleCommand (Best of both worlds)

3. Use the Cinch ViewAwareStatus service and add extra interface on your view and expose the CommandBindings and then simply add new RoutedCommands in your viewmodel via the exposed View (via the ViewAwareStatus service) CommandBindings collection. Do not forget to remove these though. You can see Bill Kempf Onyx project for an idea of how this works (simliar idea) : 

http://wpfonyx.codeplex.com/

I also wrote a small demo Onyx article before I had my own MVVM framework (AKA Cinch) : http://www.codeproject.com/KB/WPF/WPFOynxApp.aspx

 

If you use option 3 you may want to ask Bill Kempf about that approach, I will not support any issues raised by that, as it is my least favourite option, as I do not know the full ins/outs of that approach