Changing Views in a region

Topics: Prism v4 - Silverlight 4
Sep 19, 2011 at 9:33 PM


Still working my way around Prism and would appreaciate advise on this.

I have a Shell with a "Wholepage" region

I have a Login Module that loads it's view into the whole page. So when the app starts up, the login page shows up. The view model of the Login page handles all the login logic and when the user succesfully logs in it uses EventAggregation to publish that the user successfully logged in.

The ShellViewModel listens for that even and when that happens it needs to:
1. Tell the login view to go away or tell th region to remove that view
2. Tell the Commandbar region to Show the command bar (there is a Commandbar module and a ShowCommandBar bool in the CommandBar view model)
3. Load the default content view. - Again there is a UserModule and a Show UserView bool in the User VM.

All the modules are loaded via XAML.

When I try to change views in the handler for the successful login event - the handler is in the ShellViewModel, it gives me an error: "Invalid Cross Tread Access"

Any help would be really appreciated.




Sep 19, 2011 at 9:39 PM

It seems like I need to get onto the UI thread. Any idea how to do this?



Sep 19, 2011 at 10:46 PM


in the Subscribe is the answer.