Prism Integration with docking

Docking/MDI for WPF Forum

Posted 8 years ago by keshav bansal
Version: 11.2.0552
Avatar

Hi,

There are two ways to register the different views in  the region with the help of the PrismIntegration.But each way have some disadvantage .

Way 1: I have four views and i can  register these views in their corresponding regions as the dockable windows with the help of PrismIntegration.

Code for Way 1:

<Grid>

<Grid.RowDefinitions><RowDefinition Height="100"></RowDefinition>

<RowDefinition></RowDefinition>

<RowDefinition Height="40"></RowDefinition>

</Grid.RowDefinitions>

<Grid.ColumnDefinitions>

<ColumnDefinition/>

<ColumnDefinition/>

</Grid.ColumnDefinitions>

<docking:DockSite x:Name="AblationRegion" AllowDrop="True" CanDocumentWindowsRaft="True" cal:RegionManager.RegionName="AblationRegion">

<docking:Workspace><docking:TabbedMdiHost />

</docking:Workspace>

</docking:DockSite>

<docking:DockSite Grid.Row="0" Grid.Column="1" x:Name="VitalRegion" AllowDrop="True" CanDocumentWindowsRaft="True" cal:RegionManager.RegionName="VitalRegion">

<docking:Workspace><docking:TabbedMdiHost />

</docking:Workspace>

</docking:DockSite>

<docking:DockSite Grid.Row="1" Grid.ColumnSpan="2" x:Name="MainRegion" AllowDrop="True" CanDocumentWindowsRaft="True" cal:RegionManager.RegionName="MainRegion"><docking:Workspace><docking:TabbedMdiHost /></docking:Workspace></docking:DockSite>

<docking:DockSite Grid.Row="2" Grid.ColumnSpan="2" x:Name="StatusRegion" AllowDrop="True" CanDocumentWindowsRaft="True" cal:RegionManager.RegionName="StatusRegion"><docking:Workspace>

<docking:TabbedMdiHost />

</docking:Workspace>

</docking:DockSite>

</Grid>

-----------------------------

Module class having Initialize method for registering the views in their corresponding regions

In the below function StatusDocking,WaveformDocking,AblationDocking,VitalDocking are the ViewModel classes for their correspoding views.

publicvoidInitialize(){

try{

RealTime rt =newRealtime();

RegionManager.SetRegionManager(rt, regionmanager);

myRegionViewRegistry.RegisterViewWithRegion("StatusRegion", typeof(ViewModel.StatusDocking));

myRegionViewRegistry.RegisterViewWithRegion("MainRegion", typeof(ViewModel.WaveformDocking));

myRegionViewRegistry.RegisterViewWithRegion("AblationRegion", typeof(ViewModel.AblationDocking));

myRegionViewRegistry.RegisterViewWithRegion("VitalRegion", typeof(ViewModel.VitalDocking));

rt.Show();

}

catch (Exceptionex){

}

}

Problem In Way1: I am not able to dock the toolwindows(Views registered as toolwindows) in the other tollwindows(registered views)means i am not able to dock the ablation region in the vital region.

Way 2 : I have four views and i can register these views as dockable windows  in single region that is specified in the startup shell with the help of PrismIntegration.

Code for Way 2:

 

<docking:DockSitex:Name="MainRegion" AllowDrop="True" CanDocumentWindowsRaft="True" cal:RegionManager.RegionName="MainRegion">

<docking:Workspace><docking:TabbedMdiHost /></docking:Workspace>

</docking:DockSite>

</Grid>

-----------------------------------------------------------

 

 

Module class having Initialize method for registering the views in single MainRegion.

In the below function StatusDocking,WaveformDocking,AblationDocking,VitalDocking are the ViewModel classes for their correspoding views.

publicvoidInitialize(){

try{

RealTime rt =newRealtime();

RegionManager.SetRegionManager(rt, regionmanager);

myRegionViewRegistry.RegisterViewWithRegion("MainRegion", typeof(ViewModel.StatusDocking));

myRegionViewRegistry.RegisterViewWithRegion("MainRegion", typeof(ViewModel.WaveformDocking));

myRegionViewRegistry.RegisterViewWithRegion("MainRegion", typeof(ViewModel.AblationDocking));

myRegionViewRegistry.RegisterViewWithRegion("MainRegion", typeof(ViewModel.VitalDocking));

rt.Show();

}

Position of these views comes through the open function of the corresponding viewmodel classes like below....

publicvoid Open(DockingWindow dockingWindow, objectitem)

{

if (dockingWindow == null)

thrownewArgumentNullException("dockingWindow");

// Dock with the Class View, otherwise to the rightDockSitedockSite = dockingWindow.DockSite;

ToolWindow toolWindow = dockingWindow asToolWindow;

if (dockSite != null && toolWindow != null){

ToolWindow relativeToolWindow = dockSite.ToolWindows["AbaltionToolWindow"];

if (relativeToolWindow != null)toolWindow.Dock(relativeToolWindow,

Direction.Content);

else

toolWindow.Dock(dockSite,Direction.Top);

}

Problem In Way2: I am not able to fix the positions of the registered views(toolwindow) in the main appliaction.Like in the above example

I have four views and one region and each view will addded in this region but the location of the each view in this region should be fixed bydefault.

Means as i run the application ,Ablation View(view1) and thye Vital View(View2) should attached to each other and should display at the top and view3 below of these two and view4 below of the view3.

Comments (1)

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

Hi Keshav,

This sounds like the same question as in this forum post. If it is, then let's please keep the discussion limited to one post as it can get confusing.

If you can send over a small sample project that reproduces your issue (I'm guessing showing your Way2) 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

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