Event to Command

Topics: Prism v4 - WPF 4
Feb 17, 2012 at 8:53 PM

Hi Prism Masters,

What's the improvement in Prism 4.1 to support "5495 – Event to Command"?



Feb 23, 2012 at 4:33 PM

Hi Tim,

If I am not mistaken, Prism 4.1 includes its own custom InvokeCommandAction in order to provide support to event-to-command functionality. This InvokeCommandAction should be in the Prism.Interactivity project and can be used, for example, doing something like this:

          <i:EventTrigger EventName="KeyUp">
               <prism:InvokeCommandAction Command="{Binding MyCommand}" />

Based on my understanding, it was already possible to achieve event-to-command functionality using Expression Blend's InvokeCommandAction. However, Blend’s built-in InvokeCommandAction does not update the enabled state of the control based on the value of the command’s CanExecute method, which might be useful in certain cases. This is supported by Prism 4.1's InvokeCommandAction.

I hope you find this useful,

Damian Cherubini