i am developing a docking application using Prism mvvm, which consist of 2 modules ModuleA and ModuleB, both modules are using Telerik RadDocking control. For using docking control with prism, I followed some code from code library. which infact register DockingRegionAdapter as Mapping for RadDocking. DockingRegionAdapter overrides CreateRegion, where new region is created with Behaviour DockActivationRegionBehavior, as follows
1.
protected
override
IRegion CreateRegion()
2.
{
3.
var region =
new
Region();
4.
if
(!region.Behaviors.ContainsKey(
"DockActivationRegionBehavior"
))
5.
region.Behaviors.Add(
"DockActivationRegionBehavior"
, serviceLocator.GetInstance<DockActivationRegionBehavior>());
6.
7.
return
region;
8.
}
Problem: When I switch from Module A to Module B, it raises Exception at line 5 with following error message.
An exception of type 'System.InvalidOperationException' occurred in Microsoft.Practices.Prism.Composition.dll but was not handled in user code
Additional information: The Region property cannot be set after Attach method has been called.
My Code: DockingWithPrism.zip