1
votes

I found myself in a difficult situation trying to solve the following scenario:

I have two views each with 1 region, lets call these View1.RegionA, View2.RegionB. I am registering a control into these regions, lets call this Control. Control also has a region (Control.Region), into which I am registering another control, lets call this SubControl

|Module_A
  -View1
  --RegionA
|Module_B
  -View2
  --RegionB
|Module_C
  -Control
  --Control.Region
  -Subcontrol

When I try to open the MainView which contains View1 and View2 I get the following error:

"Region with the given name is already registered: Control.Region"

I've tried resolving this using Scoped regions but when I did so my app crashed is it was trying to instantiate the views at application start up which was causing my app to crash as loads of objects are not initialized at that point.

I've also tried to Bind to the Control.Region.RegionName property, but in this case my RegionContext wasn't set and got the same error as in the beginning.

Is there any other solution around this?

1

1 Answers

0
votes

This is happening because you are showing multiple instances of Control.Region, and since you are only allowed to have unique region names an exception is thrown. YOU are on the right track. You must use scoped regions to solve this. You are most likely doing something wrong in your implementation of your scoped regions. There is not enough information in your post to identify what that is, but I cover scoped regions in this PluralSight course which should help get you going in the right direction:

https://app.pluralsight.com/library/courses/prism-showing-multiple-shells/table-of-contents