“Any customer can have a car painted any colour that he wants so long as it is black” H. Ford
Trying to figure out how scoped region managers would work in Prism. We are still on .NET 3.5, so the highest version we can use is 2.x. They tell you your views may be any dependency objects. With some data templating magic I can add my view model object to a region, and it all just works.
But there are exceptions. Firstly, auto-detecting regions when the view is loaded won’t work unless your view is a
DelayedRegionCreationBehavior says so. Well, no big deal.
More trouble comes from
RegionManagerRegistrationBehavior when you attach a region name to your control. This behavior assumes that the scoped region manager (or any region manager) would be attached to an ancestor of the control in the logical tree. This would be true if what you added to the region is really the ancestor of the control. However, if what you added to the region was a data object, and the real view (which is the ancestor of the control) was created via data templating, the region manager will be attached to your data object, not to the real view, and the
RegionManagerRegistrationBehavior behavior won’t find it. Everything breaks, and you cannot use regions in scoped region managers.
Sorry for an illegible rant, I need to record what I found. More organized details later.