Prism 4.1 missing InvokeCommandAction?

Topics: Prism v4 - WPF 4
Oct 22, 2012 at 8:57 PM

I'm trying to use the new InvokeCommandAction as noted in the release notes and this workitem:

http://compositewpf.codeplex.com/workitem/5495

When I try to use the example XAML I get the error:
Error 33 The tag 'InvokeCommandAction' does not exist in XML namespace 'http://www.codeplex.com/prism'.

  • I have updated my project references from Prism 4.0 to Prism 4.1
  • I can implement the new ClearChildViewsRegionBehavior so I'm assuming my references are good
  • Intellisense for <prism: ... /> in XAML shows the following:
    • ClearChildViewsRegionBehavior
    • InteractionRequestTrigger
    • RegionContext
    • RegionManager

Code example (copied directly from the workitem):

... user control and other namespace code
            xmlns:prism="http://www.codeplex.com/prism"        
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity>
  <StackPanel>
    <TextBox>
      <i:Interaction.Triggers>
        <i:EventTrigger EventName="KeyUp">
          <prism:InvokeCommandAction Command="{Binding MyCommand}" />
        </i:EventTrigger>
      </i:Interaction.Triggers>
    </TextBox>

... rest of view code

Developer
Oct 23, 2012 at 12:52 PM
Edited Oct 23, 2012 at 4:39 PM

Hi,

Based on my understanding, the problem your are experiencing could be related to the fact that the Prism's InvokeCommandAction is located in the Microsoft.Practices.Prism.Interactivity assembly and not in the main Prism assembly. Hence in your XAML you could try adding the following reference:

(...)

 

xmlns:prism="http://www.codeplex.com/prism"
xmlns:prismInt="clr-namespace:Microsoft.Practices.Prism.Interactivity;assembly=Microsoft.Practices.Prism.Interactivity"        
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity>
  <StackPanel>
    <TextBox>
      <i:Interaction.Triggers>
        <i:EventTrigger EventName="KeyUp">
          <prismInt:InvokeCommandAction Command="{Binding MyCommand}" />
        </i:EventTrigger>
      </i:Interaction.Triggers>
    </TextBox>

(...)

 

I hope you find this handy,

Agustin Adami
http://blogs.southworks.net/aadami

Oct 23, 2012 at 3:39 PM

That worked.  

I didn't see that namespace in the release notes, did I miss it somewhere?  Or how else should I have known which namespace to use?

Thanks

Developer
Oct 23, 2012 at 5:02 PM

Hi,

It seems that the current Prism's documentation does not make any mention about the aforementioned namespace when describing Prism's InvokeCommandAction.

We will post a note in the work-item mentioning this.

Thanks for notifying this,

Damian Cherubini
http://blogs.southworks.net/dcherubini