Hide region

Topics: Prism v2 - Silverlight 3
Mar 17, 2010 at 7:00 PM

Hi,

Is it possible to hide a region when there are no active views?

Basically I'd like to collapse a region if no views are being displayed within the shell.

Many thanks,

Lee.

Apr 7, 2010 at 5:18 PM
Edited Apr 7, 2010 at 5:44 PM

Hi Lee,

Usually if an ItemsControl (ContentControl) does not have any items (content) it is not shown, unless its Width/Height is explicitly set. In this kind of scenario, you could create a RegionBehavior (concept explained here) that changes the visibility (Visible|Collapsed) of the host control based on the amount of views inside the region. Your RegionBehavior will probably need to implement IHostAwareRegionBehavior.

Please let me know if this helps.

Damian Schenkelman
http://blogs.southworks.net/dschenkelman

Jul 9, 2012 at 12:53 PM

For anyone hitting this page and looking for Prism v2 support - check this link for a solution offered by the Composite WPF codeplex site:

"Hide/Show views in regions" - http://compositewpf.codeplex.com/wikipage?title=Hide/Show%20views%20in%20regions