SL5 InteractionRequestTrigger

Topics: Prism v4 - Silverlight 4
Dec 10, 2011 at 10:00 AM

There is a piece of code which has stopped working after upgrading SL4 project to SL5.

Compilation shows an error mesage: "A value of type InteractionRequestTrigger cannot be added to a collection or dictionary of type 'TriggerCollection'.

Could anybody, pls, help to find any workaround? InteractionRequest pattern for dialogs is very useful.

Thanks, Prism4Uer.

 

...

xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
xmlns:prism="clr-namespace:Microsoft.Practices.Prism.Interactivity.InteractionRequest;assembly=Microsoft.Practices.Prism.Interactivity"
...

<i:Interaction.Triggers>
   <prism:InteractionRequestTrigger SourceObject="{Binding LoginRegistrationRequest}">
     <prism:PopupChildWindowAction>
       <prism:PopupChildWindowAction.ChildWindow>
         <Views:LoginRegistrationWindow/>
       </prismPopupChildWindowAction.ChildWindow>
     </prismPopupChildWindowAction>
   </prismInteractionRequestTrigger>
 </i:Interaction.Triggers>"

Dec 10, 2011 at 6:54 PM

I think the issue is the Prism library was built for Silverlight 4, and in a couple spots (like interactivity) that causes trouble. I haven't dug into why - perhaps because the interactivty library itself references types from Silverlight 4, and those referenced types are now upgraded to Silverlight 5?

In any case, here's what I did to workaround the problem

First I built the interactivity assembly in prism. 

  1. Download and unzip the source for Prism.
  2. Set the Microsoft.Practices.Prism.Interactivity project to compile for Silverlight 5 and build it

Since I didn't strong name my newly built library, I did this to my project that uses it:

  1. Remove the reference to Microsoft.Practices.Prism.Interactivity
  2. Browse to my application /bin folder and manually delete the copy of Microsoft.Practices.Prism.Interactivity.dll that's there (don't forget this step).
  3. Add a new referece to Microsoft.Practices.Prism.Interactivity by browsing to the newly built version from above.
  4. Rebuild solution.
Dec 10, 2011 at 8:43 PM

Thanks a lot for the clear explanation - the project works fine now!

Additionaly in PrismLibrary (before recompilation for Silverlight 5) I've updated Microsoft.Windows.Interactivity and Microsoft.Expression.Interactions references (both to new versions 5.0.5.0).

Then in my project I have used namespaces: 

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

xmlns:prism=http://www.codeplex.com/prism

instead of previous one.

There is a problem with loading modules (MEF), but this is another story.

Thank you!

Dec 10, 2011 at 9:52 PM

Jolly good. I just hope they release an official Silveright 5 (signed) build of PRISM soon.

Dec 12, 2011 at 6:13 PM
Edited Dec 12, 2011 at 6:32 PM

For those interested: I found these new DLLs here: http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=9503

Dec 12, 2011 at 7:26 PM
Edited Dec 12, 2011 at 7:34 PM

Hey.. I've also run into trouble loading modules(MEF)... curious if you have figured anything out / where you are at on this... 

My work so far indicates that the issue is with dynamically loading modules with MEF.

Maybe start a separate thread for this discussion?

Dec 12, 2011 at 7:32 PM
Im using Unity rather than med... Haven't seen any change in behavior in SL5 there.

From: acanadian
Sent: 12/12/2011 11:26 AM
To: stalbert@exploreconsulting.com
Subject: Re: SL5 InteractionRequestTrigger [CompositeWPF:282474]

From: acanadian

Hey.. I've also run into trouble loading modules(MEF)... curious if you have figured anything out / where you are at on this...

Maybe start a separate thread for this discussion?

Dec 12, 2011 at 7:41 PM

Alright.. we I'll fire up a new thread to get a discussion going on that topic.

Dec 12, 2011 at 7:45 PM

I've got stuck with MEF, unfortunatelly.

Tried using Microsoft.Practices.Prism.MefExtensions from Prism4 and recompiled for SL5. Treid changing 'Copy Local' to True/False for this dll (in Prism 4 it was to be set up to 'False').

Nothing helped, no idea.

 

 

Dec 12, 2011 at 7:53 PM

That is what I did so far.  Recompiled MefExtensions DLL to SL 5.  Updated references in my solution.  Ensured that copy local was true in the main project and false in all others. 

MEF is loading correctly in the boot strapper. I've even been able to load one of my modules dynamically, which suggested that MEF is working. There just might be an assembly in the XAP's that is not SL 5 friendly.  Currently investigating..

Dec 12, 2011 at 8:56 PM

You might try manually cleaning your build directory for your app. That is, make sure no copies of Silverlight4 DLLs still exist in your bin/debug.

That’s why I mentioned the manual delete step in the original post, since I think Silverlight picks up the strong-named (signed) DLLs in the bin folder before it will use your recompiled (not strong-named) version.

From: Prism4User [email removed]
Sent: Monday, December 12, 2011 11:46 AM
To: stalbert@exploreconsulting.com
Subject: Re: SL5 InteractionRequestTrigger [CompositeWPF:282474]

From: Prism4User

I've got stuck with MEF, unfortunatelly.

Tried using Microsoft.Practices.Prism.MefExtensions from Prism4 and recompiled for SL5. Treid changing 'Copy Local' to True/False for this dll (in Prism 4 it was to be set up to 'False').

Nothing helped, no idea.

Dec 12, 2011 at 9:42 PM

Yes, I remember that (I've described it a bit earlier in the new thread started by 'Acanadian': http://compositewpf.codeplex.com/discussions/282685).

But error still exists and I don't know which setting of 'Copy Local' for MefExtension is better: 'False' (as in Prism 4) or 'True'.

Both settings give an error, but setting 'True' loads the shell at least and shows ' ... initialization error ... ' instead of '...MEF assembly loading ...' error.

 

Dec 25, 2011 at 1:18 AM

Is there any info from PRISM team on when PRISM for SL5 will be released? Even PRISM4 compiled/tested and signed will be great for now. We just can't upgrade and use SL5 because of this...

Developer
Dec 26, 2011 at 4:19 PM
Edited Dec 26, 2011 at 4:20 PM

Hi,

You might find useful information regarding the future of Prism in the following links:

I hope you find this handy,

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

Dec 26, 2011 at 6:26 PM

Thank you, I've seen 4.5 roadmap but that was something too far away. 4.1 is exactly what I needed to know. Hopefully it will be relased in Jan 2012

Jan 8, 2012 at 11:00 AM

I went through the same process of converting a SL 4 Prism app to SL 5 and encountered similar problems as discussed here.  I finally got it all working and wrote up the procedure in my blog at http://dotnetsilverlightprism.wordpress.com/  I hope this helps.

Feb 22, 2012 at 12:16 PM

I found that by inalling Expression Blend preview for silverlight 5 solved the issue.  It ships with the dlls versions required.