CompositeWPF/Prism EventAggregation Exception

Posted at: 3/4/2010 at 5:52 AM by saravana

Just a small reminded for myself. When you are using Publish/Subscribe EventAggregation mechanism provided by PRISM along with Unity to resolve types. It's important to specify the Action method on subscribe to be public.

Example:

TextChangedEvent evt = eventAggregator.GetEvent<TextChangedEvent>();
           evt.Subscribe(OnSubscibeForNewText);

///

///

public void OnSubscibeForNewText(string payload)

If it's not public, Unity will have issues resolving the type and you'll see an exception as shown below

Attempt by method 'Microsoft.Practices.Composite.Events.DelegateReference.TryGetDelegate()' to access method 'ModuleA.ViewModel.ModuleAView2VM.OnSubscibeForNewText(System.String)' failed.

Nandri!

Saravana

Tags: |  Categories: Silverlight
Actions: Email this article Email | Kick it! | DZone it! | Save to del.icio.us | Technorati Links
Post Information: Permanent LinkPermalink | CommentsComments(0) | Comments RSS

Comments

Add comment




  Country flag

biuquote
  • Comment
  • Preview
Loading