I have Silverlight application using Prism and I am using a ContentControl as a region, something like below:
<ContentControl RegionManager.RegionName="Demo"/>
In some rare cases the application is throwing an exception
"This control is being associated with a region, but the control is already bound to something else".
I checked the prism library and it is throwing this error from ContentControlRegionAdapter.Adapt method. In this method it is doing following checking
if (regionTarget == null)
throw new ArgumentNullException("regionTarget");
bool contentIsSet = regionTarget.Content != null;
if (contentIsSet)
{
throw new InvalidOperationException(Resources.ContentControlHasContentException);
}
In which scenario will contentIsSet be true?
Also is there any issue if I remove that condition and set the view to the content directly?