Loading message layer to cover all regions

Topics: Prism v4 - WPF 4
Oct 18, 2013 at 3:16 PM
I have two regions - left region and right region. Basically when any item in left region is triggered, right region will display the data. The problem is sometimes the data takes time to load and make the application not responding. Is there a way to create another layer showing the loading message while the data is processed and this layer covers entire regions? so that users can not click any items.

Any thoughts?

Thanks,
Brew
Developer
Oct 18, 2013 at 5:19 PM
Hi Brew,

A possible approach could be to create a simple overlay in the Shell of you application to cover its contents completely and that could be shown / hidden when needed. Examples of such overlays could be a simple rectangle, an image or a custom UserControl as long as it's on top of all the elements of the Shell.

By default this overlay would have its Visibility property set to Collapsed (so that it's not visible and does not interfere with the rest of the application). When you need to show it, you just need to change its Visibility to Visible and it should cover then the entire contents of the Shell, including the regions.

Regarding the logic to do this, you could create a very simple view model from the Shell which could subscribe to an event via the EventAggregator. When an operation needs to show or hide the overlay it could publish this event and the view model would change the state of the overlay accordingly. For this, you can use an interaction request, a binding from the Visibility property to a property in the view model through a boolean-to-visibilty value converter, etc.

I hope you find this useful,

Damian Cherubini
http://blogs.southworks.net/dcherubini
Oct 18, 2013 at 6:29 PM
Hi Damian,

Thank you. I will give it a try!

Thanks,
Brew