Click here to Skip to main content
Licence Apache
First Posted 11 Feb 2012
Views 6,143
Bookmarked 1 time

Prism 2.x Weirdness

By | 11 Feb 2012 | Technical Blog
Prism 2.x Weirdness
A Technical Blog article. View original blog here.[^]

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 FrameworkElement, because 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.

License

This article, along with any associated source code and files, is licensed under The Apache License, Version 2.0

About the Author

Ivan Krivyakov

Architect
Sungard Consulting Services
United States United States

Member



Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
-- There are no messages in this forum --
Permalink | Advertise | Privacy | Mobile
Web02 | 2.5.120517.1 | Last Updated 11 Feb 2012
Article Copyright 2012 by Ivan Krivyakov
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid