PrismIntegration with docking

Docking/MDI for WPF Forum

Posted 7 years ago by keshav bansal
Version: 11.2.0553
Avatar

Hi,

I am using the PrismIntegration with docking concept in my appliaction but still i am facing problem.

PrismIntegration with docking means registering or displaying the usercontrols as the respectively dockable toolwindows in main shell of the application.

Problem1: As i am able to register the usercontrols as the dockable toolwindows in the main shell but the ui part(Controls like button ,textboxes in the usercontrol) of the usercontrol is not dicplaying in the main shell of the application.

Module class for registering the viewmodel(viewmodel of the userconterol) of the view(usercontrol) in the docksite region below

[ModuleExport(typeof(RealTimeModule1), InitializationMode = InitializationMode.OnDemand)]

public class RealTimeModule1 : IModule

{

private readonly IRegionManagerregionmanager;

private readonly IRegionViewRegistry myRegionViewRegistry;

private readonly IEventAggregator eventAggregator;

[ImportingConstructor]

public RealTimeModule1(IRegionManager regionManager, IRegionViewRegistry registry, IEventAggregatorevntAggregator)

{

this.regionmanager = regionManager;

this.myRegionViewRegistry = registry;

this.eventAggregator = evntAggregator;

}

public void Initialize()

{

realshell =newRealTimeShell();

RegionManager.SetRegionManager(realshell, regionmanager);

AblationModule.AblationView.ViewModels.AblationViewModel av = new AblationModule.AblationView.ViewModels.AblationViewModel();

var reg = regionmanager.Regions["MainRegion"].Add(av);

realshell.Show();

}

Above added viewmodel class consist of the Initialize and Open method of the IDockingWindowInitializer, IDockingWindowItemTypeProvider

Comments (6)

Answer - Posted 7 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Keshav,

You would also need to ensure that you have an implicit DataTemplate defined for the AblationViewModel type, which contains the UserControl you want displayed. If you look in our Prism Integration sample, you will see we define implicit DataTemplates in the "Views\ImplicitTemplates.xaml" file, which is then merged into the application's resources (as shown in the WindowsApp.xaml file).

But if you can please put together a small sample project that reproduces your issue and email it over then we can take a closer look. Be sure to remove any executables or change the extension of the zip file to ensure it gets past our email filters.


Actipro Software Support

Posted 7 years ago by keshav bansal
Avatar

Hi,

As my  Ablation viewModel exists in the different DLL and i had added theImplicit Template in that library and setting the resources for the AblationView usercontrol with Implicit template is also done with the help of the Usercontrol.Resources but its not considering that template during the run time .

Because as i saw in my PrismIntegration sample after adding the viewmodel in the region debug point firstly will goes to the Initialize and open Function of the viewmodel and after that while reading the Implicittemplate, debug point is going to the contstructor of the  View(usercontrol) and then it will display the controls or data of the usercontrol in the region as the dockable window.

But in my case after adding the viewmodel in the region debug poing firstly will goes to the Initialize and open Function of the viewmodel(AblationViewModel) and after that its not reading the ImplicitTemplate file and debug point is not going to the constructor of the AblationView(Usercontrol) and its displaying only the Ablationview usercontrol as the dockable window but not showing the content of the Ablation View(Usercontrol ).

Code of theModule class that adds the viewmodel in the region.

public voidInitialize()

{

realshell =newRealTimeShell();

RegionManager.SetRegionManager(realshell, regionmanager);

AblationViewModel av = new AblationViewModel();

this.regionmanager.Regions["MainRegion"].Add(av );

realshell.Show();

}

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

Hi Keshav,

It sounds like the DataTemplate resource is not properly configured or is not being merged in properly to the application resources. As I said,  if you can please put together a small sample project that reproduces your issue and email it over then we can take a closer look. Be sure to remove any executables or change the extension of the zip file to ensure it gets past our email filters.


Actipro Software Support

Posted 7 years ago by keshav bansal
Avatar

Hi,

If i dont want to use the Implicit temple in this application then Can i do the same by programatically.

Means Can i use the code that follow the same functionality like the ImplicitTemplate in the ViewModel class of the View .

Means Which code to use in the Viewmodel class of the view ( consists of the Initialize and Open function of the IDockingWindowInitializer,

IDockingWindowItemTypeProvider) that meat the same functionality like the ImplicitTemplate that will binds the view to the viewmodel and my

view data will be displayed in the main shell.

Answer - Posted 7 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Keshav,

If you don't want to use an implicit DataTemplate, then you would need to explicitly set the ContentTemplate of the DocumentWindow/ToolWindow explicitly. There are several ways to do this:

1. You can simply set the ContentTemplate/ContentTemplateSelector property on the DocumentWindow/ToolWindow. This specifies the DataTemplate for each window separately. This can also be done using an implicit Style for the DocumentWindow or ToolWindow type, but effectively be the same as #2 below.

2. You can set the DocumentItemTemplate/DocumentItemTemplateSelector or ToolItemTemplate/ToolItemTemplateSelector properties on the DockSite. This will be passed to every DocumentWindow and ToolWindow, respectively. But you can override it using #1 above for specific windows.

3. You can set the DocumentItemContainerStyle/DocumentItemContainerStyleSelector or ToolItemContainerStyle/ToolItemContainerStyleSelector properties on the DockSite. This is similar to the implicit Style from #1.

You can perform #1 where ever you like, including in the IDockingWindowInitializer.Initialize method.


Actipro Software Support

Posted 7 years ago by keshav bansal
Avatar

Hi,

Thanks alotttttt...............

Its workign according to ur response.

The latest build of this product (v2019.1 build 0681) 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.