This is a migrated thread and some comments may be shown as answers.

navigation problem in prism mvvm application where modules have docking Control

4 Answers 123 Views
Docking
This is a migrated thread and some comments may be shown as answers.
Abdul
Top achievements
Rank 1
Abdul asked on 11 Jun 2015, 07:59 AM

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.}
 Important point to notice is Both Modules have Docking control in it you can find my code Here.

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

4 Answers, 1 is accepted

Sort by
0
Vladi
Telerik team
answered on 12 Jun 2015, 07:55 AM
Hi,

One common issue when working with RadDocking and PRISM scenarios is that the region used by the PRISM library is not set to the correct element. The best practice is to set as region the RadDocking control itself or if it is preferred set a RadPane instance as region and add a ContentControl inside its Content which will be further used by the PRISM library. We have prepared a sample project which demonstrates the best approach of using the RadDocking control with the PRISM library and the runnable project is available in our SDK repository located at GitHub. You can find the specific PRISM example project here and download the entire repository as a zip file from here.

For further details you can also refer this blog post which explains in details the mentioned sample project, hope this is helpful. If we have missed something could you please open a new support thread and in that thread send us the mentioned source code and code library for further investigation of the case.

Regards,
Vladi
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Abdul
Top achievements
Rank 1
answered on 12 Jun 2015, 03:45 PM

@Vladi

I have implemented docking with prism using same sample code you mentioned. and it is working very well as long as there is one Docking control.The problem occurs when I another module which has one more docking control. I have already mentioned every detail in my post, please read it carefully, I have also added a sample code, which is illustration the issue i am facing, i would like you to please download it and try running it.

Problem statement: my prism application has 2 module each has its own dockingControl, when i switch from one module to another module, DockingRegionAdapter raises an exception while creating Region.

0
Abdul
Top achievements
Rank 1
answered on 12 Jun 2015, 03:46 PM
@VladiI have implemented docking with prism using same sample code you mentioned. and it is working very well as long as there is one Docking control.The problem occurs when I another module which has one more docking control. I have already mentioned every detail in my post, please read it carefully, I have also added a sample code, which is illustration the issue i am facing, i would like you to please download it and try running it.Problem statement: my prism application has 2 module each has its own dockingControl, when i switch from one module to another module, DockingRegionAdapter raises an exception while creating Region.
0
Accepted
Vladi
Telerik team
answered on 15 Jun 2015, 03:16 PM
Hello,

We noticed that you have submitted the discussed scenario in a support thread with ID: 944154 could we continue the discussion there. I will post my latest response in this thread in order for it to be available for the community also:
The issue is caused by the DockActivationRegionBehavior instance being shared. The DockActivationRegionBehavior does not have any PartCreationPolicy set to it and the RegionBehavior is shared which caused an exception in the PRISM's Microsoft.Practices.Prism.Composition assembly. You should set the PartCreationPolicy to NonShared in order for the PRISM library to be able to create a new RegionBehavior instance each time it needs to. Our "ShellPrism" example project was design to showcase how the RadDocking control could be used with the PRISM library when the RadDocking control has only one instance which is why the custom RegionBehavior in our SDK repository does not have any PartCreationPolicy assigned to it.


Regards,
Vladi
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
Docking
Asked by
Abdul
Top achievements
Rank 1
Answers by
Vladi
Telerik team
Abdul
Top achievements
Rank 1
Share this question
or