Reputation: 17415
I'm working on my WPF
Prism
application and trying to show some of my different Views
in a Region
. So i use the following code in my Shell.xaml
and it works well (it shows multiple view under each-other).
<ItemsControl x:Name="MainRegion" prism:RegionManager.RegionName="WorkspaceRegion" Width="400"/>
I have an another Window
named WinExtra.xaml
. My application creates an instance of it at Run-Time
when user click on a Button
in Shell.xaml
.
Inside the WinExtra
i have some TabControl
and inside theme i keep my UserControls
.
Now i want to put the same Region
like above inside one of these UserControls
. so i write the above code again but this time inside WinExtra.xaml> TabControl1> TabItem1> UserControl1.xaml
:
<ItemsControl x:Name="MainRegion" prism:RegionManager.RegionName="WorkspaceRegion" Width="400"/>
But after i create an instance of WinExtra
on Showing
it, i get this error:
An unhandled exception of type 'Microsoft.Practices.Prism.Regions.Behaviors.RegionCreationException' occurred in Unknown Module.
Additional information: An exception occurred while creating a region with name 'WorkspaceRegion'. The exception was: System.Collections.Generic.KeyNotFoundException: The IRegionAdapter for the type System.Windows.Controls.ItemsControl 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 Microsoft.Practices.Prism.Regions.RegionAdapterMappings.GetMapping(Type controlType)
at Microsoft.Practices.Prism.Regions.Behaviors.DelayedRegionCreationBehavior.CreateRegion(DependencyObject targetElement, String regionName).
Note: I use MahApps.Metro
in this project. and all window types are controls:MetroWindow
Upvotes: 3
Views: 2342
Reputation: 17415
I founded the error reason & solved it.
I was loading Prism dll assembly during loading my module assembly after showing shell.
Now i prevent this prism dll loading and have not any RegionCreationException
in my project
Upvotes: 0
Reputation: 5301
For me the problem was that I had a reference to the old Prism.Composition package which caused a conflict. A simple Uninstall-Package Prism.Composition <Project> -Force
fixed the issue.
Upvotes: 0