Getting the CurrentView name of a region

Aug 27, 2012 at 8:18 PM

Suppose I have a region with several views registered in it.

I have always been navigating to one of them.

Is there a simple way of getting the name of the currently navigated view on a region?

Silverlight 5 Prism 4.1

 

Rafael

Developer
Aug 28, 2012 at 12:56 PM

Hi,

Based on my understanding if you are using region-based navigation operations you could retrieve the current navigation entry of the content that is currently displayed by benefiting of the Navigation Journal's CurrentEntry property. For example you could try something like this:

this.regionManager.Regions["MyRegion"].NavigationService.Journal.CurrentEntry.Uri;

For more information about the Navigation Journal you could check the following section of the Prism documentation:

Also, if what you want is to retrieve the current active view in a single active region, for example you could retrieve it using the ActiveViews property defined in the Region class, which returns the collection of all the active views in the region. For example like this:

this.regionManager.Regions["MyRegion"].ActiveViews.FirstOrDefault();
I hope you find this helpful,

Agustin Adami
http://blogs.southworks.net/aadami