Active Child View

Topics: Prism v4 - WPF 4
Jan 21, 2011 at 6:32 AM

Hi,

I am creating a small app, where I will open a new child tab only if no other tabs are open.

Say, I have a button, when I click that, I open a tab (a child view in marked region). If I already have a tab open, I will not open any tabs.

Is there any way to check, whether my region is already containing a view or not?

 

Any pointers/links appreciated.

Regards,

Indro

P.S. Pls let me know, if question is clear enough:P

Jan 21, 2011 at 5:46 PM

Hi,

Based on my understanding of your scenario, you could check the views holded in a region by simply obtaining an instance of the RegionManager and then ask for the active views on that region.

For example:

IRegionManager rm = ServiceLocator.Current.GetInstance<IRegionManager>();
var views = rm.Regions["MySpecificRegion"].ActiveViews;

and then you could check any condition by iterating views collection.

Also, you can read more about Prism Regions in the following links:

Let me know if this information helps you.

Thanks,

Miguel Bronzovic
http://blogs.southworks.net/mbronzovic