How to get Region Hosting Control Type?

Topics: Prism v4 - WPF 4
Sep 8, 2011 at 5:58 AM

 <ContentControl x:Name="LoginStateRegion" 

How can I get the the hosting control Type(there is contentencontrol) In viewModel?

Sep 8, 2011 at 3:12 PM


You could create a custom region behavior that implements IHostAwareRegionBehavior, which provides a HostControl property to get or set the hosting control the region is attached to, and then obtain the type from the control retrieved through that property.

You will find more information about this in the following links of the Prism documentation:

Note: there is a mistake in the interface name in the documentation, IHostControlAwareBehavior should be IHostAwareRegionBehavior

 I hope you find this useful.

Agustin Adami

Sep 8, 2011 at 3:52 PM

Thank you!