Load documentview in module on demand when using Prism4

Docking/MDI for WPF Forum

Posted 8 years ago by ting xue
Version: 11.1.0542
Avatar
Hi,

I am trying to integrate the docking and MDI component into MS Prism v4 pattern.

I have tried the prism-integration sample. It works well. But I have tow questions beyound the sample.

1. I don't want the documentviews which are defined in a module to be injected into the shell during initializing. Instead of that, I would like to use a menuitem in main shell to load these documentviews and then show them in dockworkspace. How to make it happen?

2. I have no idea how to show the documentviews again after I click "X" to close them.

Can I get some advice?

Thank you.

[Modified at 05/06/2011 04:37 AM]

Comments (2)

Posted 8 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hello,

1. To prevent the DocumentWindows from opening automatically, you'd need to use a custom DocumentWindowInitializer. Something like this should work:
public class MyDocumentWindowInitializer : DocumentWindowInitializer {

    public override void Open(DockingWindow dockingWindow, object item) {
        // TODO: Call base.Open if you want to open the window, otherwise do not call it
        base.Open(dockingWindow, item);
    }

}
Then you'd use that as your initializer, instead of the default DocumentWindowInitializer. To open a specific view, you'd need to "activate" it in the DockSiteRegion. Assuming you have an instance of the RegionManager, you can get the region and activate a view like so:
// Get the DockSite region
var region = regionManager.Regions[RegionNames.MainRegion];

// Activate the view, which will open the document
region.Activate(view);
2. This is the same as above, you simply activate the view.

Also, keep in mind that the full source is available for the Docking.Interop.Prism assembly, so you can see what's going on there. The code is available at http://actipro.codeplex.com.


Actipro Software Support

Posted 8 years ago by ting xue
Avatar
Good idea.

Thanks a lot for your quick reponse.
The latest build of this product (v2018.1 build 0675) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.