I've got a simple bit of code to control my layout;
var pageLogin = Container.Resolve<MainPagesModule.Views.Login>();
var pageLogout = Container.Resolve<MainPagesModule.Views.Logout>();
If I wanted to pass some data to the logout view, how would I do that?
thanks in advance
If I understand your scenario correctly, you want to be able to store specific data in your
LogoutView after you got an instance of it. If this is the case, a possible approach could be using constructor injection, by getting as a parameter in your view the data object you require. In this way, your view has a constructor that resolves a dependency
to this object and automatically injects the view with it. To be able to make this work, you first need to register the data object in the
Unity container of your application.
In this article, from
the Composite Application Guidance for WPF & Silverlight documentation, you can check how dependency injection is used to inject the presenter with its related view.
For more information on how to use the UnityContainer you can check the
Container design concept
Design Patterns: Dependency Injection article.
Remember that this is one possible approach. If another approach suite your scenario better you should use it.
Please let me know if this helps.