Reputation: 1
I have a region name attached it a ContentControl via a static string binding in the Shell,xaml file as shown below:
<ContentControl prism:RegionManager.RegionName="{x:Static infrastructure:RegionNames.ContentRegion}"
Margin="1,3,3,3" />
The static string is defined as shown:
namespace IGOutlook.Infrastructure
{
public static class RegionNames
{
public const string RibbonTabRegion = "RibbonTabRegion";
public const string OutlookBarGroupRegion = "OutlookBarGroupRegion";
public const string ContentRegion = "ContentRegion";
}
}
When I run the application and Exception is thrown complaining about the ContentControl not being registered. Any reason you can think of while this occurrs?
I have two custom controls also in the Shell.xaml file and they use the two remaining static strings in the RegionNames class to bind to the RegionName and no exception occurs on either of the two controls:
<dxn:NavBarControl prism:RegionManager.RegionName="{x:Static infrastructure:RegionNames.OutlookBarGroupRegion}"
DockPanel.Dock="Left"
Width="200"
/>
<dxr:RibbonControl
RibbonStyle="Office2010"
DockPanel.Dock="Top"
prism:RegionManager.RegionName="{x:Static infrastructure:RegionNames.RibbonTabRegion}">
I am using Devexpress controls for the custom controls.
-ContentControl Exception Not Registered In Region Adapter 'ContentRegion'. The exception was: System.Collections.Generic.KeyNotFoundException: The IRegionAdapter for the type System.Windows.Controls.ContentControl is not registered in the region adapter mappings. You can register an IRegionAdapter for this control by overriding the ConfigureRegionAdapterMappings method in the bootstrapper. at Prism.Regions.RegionAdapterMappings.GetMapping(Type controlType) in C:\Prism-7.2.0.1422\Prism-7.2.0.1422\Source\Wpf\Prism.Wpf\Regions\RegionAdapterMappings.cs:line 63 at Prism.Regions.Behaviors.DelayedRegionCreationBehavior.CreateRegion(DependencyObject targetElement, String regionName) in C:\Prism-7.2.0.1422\Prism-7.2.0.1422\Source\Wpf\Prism.Wpf\Regions\Behaviors\DelayedRegionCreationBehavior.cs:line 127.
Below is the name portions of the Shell.xaml code
<dxr:DXRibbonWindow Title="Shell" Height="300" Width="500">
<Grid>
<dxb:BarManager Name="barManager1">
<dxb:BarManager.Items>
<dxb:BarButtonItem x:Name="barButtonItem1"
Content="BarButtonItem"
Glyph="{dxc:DXImage 'Images/Actions/Apply_16x16.png'}"
LargeGlyph="{dxc:DXImage'Images/Actions/Apply_32x32.png'}"/>
</dxb:BarManager.Items>
<DockPanel>
<dxr:RibbonControl
RibbonStyle="Office2010"
DockPanel.Dock="Top"
prism:RegionManager.RegionName="{x:Static
infrastructure:RegionNames.RibbonTabRegion}">
.....
</dxr:RibbonControl>
<DockPanel LastChildFill="True">
<dxn:NavBarControl prism:RegionManager.RegionName="
{x:Static infrastructure:RegionNames.OutlookBarGroupRegion}"
DockPanel.Dock="Left"
Width="200"
/>
<ContentControl
prism:RegionManager.RegionName="{x:Static
infrastructure:RegionNames.ContentRegion}"
Margin="1,3,3,3" />
</DockPanel>
</DockPanel>
</dxb:BarManager>
</Grid>
</dxr:DXRibbonWindow>
Upvotes: 1
Views: 336
Reputation: 160
In my case, the cause was that I tried to set up containerRegistry
based on convention over configuration and accidentally registered a class that exists in a Prism assembly.
Upvotes: 0