toolbar authentication view / guest view

Topics: Prism v2 - Silverlight 2
Apr 27, 2009 at 6:27 PM
I have a toolbar in a region. It shud show Sign In when the user  is not authenticated and when the user is authenticated it should show logout and few additional links.

I have a Guestview and have a AuthenticatedView.. By default on Module load i register GuestView.. Now do I add activate this new AuthVview into the region.

Also should this be in a module or in infrastructure?

Apr 28, 2009 at 9:31 PM

Hi Meetsekhar,


Although I do not know you application specifics I believe you have something like this:


So I assume the Toolbar Region contains your ToolBarView, and you change the content in your Main Region depending if the user has signed in or not (if the user has not signed in you show the GuestView and if he has you show the AuthenticatedView).

I do not know the specifics of your application, but you usually create a module for every “atomic” piece of functionality of your application. Therefore, assuming they are in different modules you could:

1.       Publish an Event using the Event Aggregator in the module where the login is performed once the user gets logged (in your scenario the module that has the ToolBarRegion, but it could also be in a service).

2.       Suscribe to the previously published event and handle it in the module where the AuthenticatedView is placed (this is usually done in a presenter or model class).

3.       Use View Injection, to place the AuthenticatedView in the Main Region.

The Composite Application Guidance for WPF & Silverlight has some Quickstarts that deal with the things I mentioned above:


·         View Injection Composition QuickStart (you can find it in the ~DecompressionFolder\Quickstarts\EventAggregation\EventAggregation.sln)

·         Event Aggregation QuickStart (you can find in it the ~DecompressionFolder\Quickstarts\UI Composition\ViewInjection\ViewInjectionComposition.sln)


Please let me know if this helps.


Damian Schenkelman



Apr 28, 2009 at 10:08 PM
Thanks for your reply. How does it go when i have to change views for ToolBar REgion based on Auth / guest

I need to toggle the view of the toolbar not the main region. So the toolbar view shows Sign/Join links when the user is not authenticated. When the user is authenticated the toolbar view it would show a signout link.

So my quesiton is more. DO i need to have two views [ toolbar auth view/ toolbar guest view] for the toolbar.. and should that be a seperate module or is it more a control in the infrastructure.

If in a seperate module, I have sign as a seperate module. How does it go?

Do you get my question or am I just confusing u