a bug?Region delete view then clear RegionManager

Topics: Prism v2 - WPF 3.5
Mar 26, 2009 at 10:04 AM
   When we create Region with new RegionManager with follow code.

  the currentView also have a region,so I can get the RegionManager with RegionManager.GetRegionManager(currentView).It will working.
  But sometimes we need remove the currentView from new created region.So we also want to clear the currentView's AttachProperty (RegionManager.RegionManagerProperty)

we can lookup remove method with region 

        public virtual void Remove(object view)
            ItemMetadata itemMetadata = this.GetItemMetadataOrThrow(view);


            DependencyObject dependencyObject = view as DependencyObject;
            if (dependencyObject != null && Regions.RegionManager.GetRegionManager(dependencyObject) == this.RegionManager)

Now,if the RegionManager created with new RegionManager.Then the view can't clear the RegionManager.RegionManagerProperty.
I think this is bug.
Mar 27, 2009 at 2:06 AM
Can any one help me?
Apr 29, 2009 at 9:28 AM

 I am facing similar issue, can't remove a region form the RegionManager.

Can someone please suggest a solution for this,

Thank you,
Apr 29, 2009 at 8:09 PM
Edited Apr 29, 2009 at 8:11 PM

Hi Clingingboy,


This is the intended behavior of the Remove() method. That is because, in case you have manually set a RegionManager to your view (instead of using the overload of the Region that does this) , perhaps you do not want to lose it “automatically” when calling this method.


To clear the property manually you can do something like this:


      DependencyObject dependencyObject = currentView as DependencyObject;

if (dependencyObject != null)


dependencyObject.ClearValue(RegionManager.RegionManagerProperty); // IRegionManager viewRegionManager = RegionManager.GetRegionManager(view); viewRegionManager will be null



Please let me know if this helps.


Damian Schenkelman