Problem with View Discovery

Topics: Prism v2 - Silverlight 3, Prism v2 - WPF 3.5
Nov 17, 2009 at 10:51 AM
Edited Nov 17, 2009 at 11:19 AM

Hi all,

currently I have a problem by using View Discovery and Silverlight 3. I try to outline my implementation solution as below:

1) I use one ChildWindow for a login dialog that hosts a region with ContentControl.

2) I register a View with this region by using View Discovery.

3) The first time when the Login Dialog is showed, everthing works perfectly.

4) The second time when the Login Dialog is showed (this dialog is created again), the exception namely ArgumentException (the value is out of range) is thrown by the method CreateRegion in DelayedRegionCreationBehavior class.

I traced the error and found out that the error had occurred actually within the method Adapt in the ContentControlRegionAdapter. The following code is suspected:


region.ActiveViews.CollectionChanged += delegate
                regionTarget.Content = region.ActiveViews.FirstOrDefault();

As you can see, the system try to assign the first ACTIVE View to the Content of the given ContentControl. I figured out that, all relevant Info of both 1st run and 2nd run was the same, but at the 2nd run the ArgumentException was thrown.


So, I were maybe wrong? And what should I do? Should I change my implementation way or change the behavior of the ContentControlRegionAdapter?


Thank you for your helps!


Nov 17, 2009 at 7:52 PM
Edited Nov 17, 2009 at 8:01 PM

Edit: I made a mistake by answering in the wrong thread.

My apologies,

Fernando Antivero,