StockTraderRI, Silverlight, Subscribe TickerSymbolSelectedEvent in ShellPresenter

Topics: Prism v4 - Silverlight 4
Aug 31, 2010 at 11:17 PM

In StockTraderRI WatchModule (Silverlight), when select a item in the datagrid, the TickerSymbolSelectedEvent is published.  TrendLinePresentationModel module subscribes this event. Now I want to subscribe it from StockTraderRI.Silverlight.ShellPresenter, but the event handle is never fired. In ShellPresenter constructor, I put: eventAggregator.GetEvent<TickerSymbolSelectedEvent>().Subscribe(this.TickerSymbolChanged);, then provide handler:  public void TickerSymbolChanged(string newTickerSymbol). But this TickerSymbolChanged is never got called. I really appreciate if anyone could provide insight suggestions & understandings.

 

Sep 8, 2010 at 1:06 AM

Shirley,

Sorry you are having a problem getting this to work for you.

Please try adding the  ThreadOption.UIThread to the Subscribe call.  This is required if the event is being published on another thread and you need it on the UI Thread.

eventAggregator.GetEvent<TickerSymbolSelectedEvent>().Subscribe(this.TickerSymbolChanged, ThreadOption.UIThread);

Have a nice day,

Karl