silverlight4 EventToCommand

Topics: Prism v4 - Silverlight 4
Jul 30, 2012 at 6:26 PM

Hi

I'm using prism and MVVM architecture for my silverlight application and I have a problem with 

interavtivity,here is the code on xaml in my module:

<i:Interaction.Triggers>     

     <i:EventTrigger EventName="Loaded">       

          <cmd:EventToCommand Command="{Binding Path=LoadedCommand,                            Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" PassEventArgsToCommand="True"/>     

  </i:EventTrigger>   

</i:Interaction.Triggers>

when loading the module in my shell proect i get this error:

"The attachable property 'Triggers' was not found in type 'Interaction'."

i used interactivity in my wpf application before and i didn't have any problem...

can anybody help me with this plzzzz....????

Developer
Jul 30, 2012 at 7:53 PM
Edited Jul 30, 2012 at 7:54 PM

Hi,

Based on your description, it seems that you have a problem related with references.

Please take into account that you need to add a reference to the System.Windows.Interactivity assembly in both the Shell and the Module projects of your application in order to use interactions in Prism. If the aforementioned assembly is only referenced in the Module, but not in the Shell, the "interactions" declared in views in the modules might not be resolved during runtime.

Also, you could check that the "i" namespace you are using in your view is declared like this:

xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"

I hope you find this useful,

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

Jul 30, 2012 at 8:15 PM

I've added the System.Windows.Interactivity refrence to shell project and it just worked,

thenks that was a big help...