If you wish to obtain the host control of the region inside your RegionBehavior
you can make it implement the
interface, which defines a HostControl
property. Said property should be automatically populated with the host control of the region when the behavior is attached to it.
However, using a RegionBehavior
to implement this functionality might be an overkill, specially if you need this behavior in only one specific region of your application. Another possible approach is to implement the logic to show / hide the
region in the code behind of the view where it's defined. This can be implemented in the same way: subscribing to the
event of the Views
collection and then modifying the host control properties. In this case, you will have access to the host control and the logic to change the view will be contained in the view itself.
On the other hand, if you need to implement this functionality in other regions of your application or you don't want to add code in your views' code behind, using a
might be a more suitable approach.
I hope you find it useful,