Dynamically set the size of the ToolWindows.

Docking/MDI for WPF Forum

Posted 8 years ago by keshav bansal
Version: 12.1.0560
Avatar

Hi,

I am able to register the views(View1,view2) aligned horizontally to each other inside the two child docksite(docksite1,docksite2) respectively using PrismIntegration with docking and i also have the one  parent docksite(baseDocksite) for these two child docksite.

I am able to link the any of the child docksite with parent docksite.

Means toolwindow from the docksite1 can be docked to the top of the parent docksite.

But the problem is ,while dragging the toolwindow from the docksite1 and dockguide for Parent docksite  is displaying for all four directions(position for docking of the toolwindow),

if i dragged toolwindow and hover the  mouse on the top dockguide icon ,shaded area is displaying for the region or height in which my dragged toolwindow will display. I want to customize this  height of this region for  this top dockguide. 

 

Means If there are toolwindows(toolwindow1,toolwindow2) in their respective docksites(docksite1,docksite2) and these docksite are linked to each other and if i drag the toolwindow1 and move the mouse in docksite2(toolwindow2) and hover the mouse on the displayed dockguide icons of the top position and then shaded area will display for the region or height in which my dragged toolwindow will display. I want to customize this height of this region for this top dockguide.

Comments (9)

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

Hi Keshav,

Sorry but we don't have any customization points for dynamically changing the drop size based on target location.

The drop target size is based on several factors like available size and the last docked state size.  We haven't tried this but you might be able to set the DockSite.DockedControlSize attached property value on the tool window being dragged in your WindowDragging handler.  But note that it will probably affect the attempted drop target size no matter what side of a DockSite you are dropping on since it would be set right when the drag is starting.


Actipro Software Support

Posted 8 years ago by keshav bansal
Avatar

Hi,

As there is not any function like Docksite.DockedControlSize........

Can i reset the last docked state size on the windowDragging or WindowDragged event handler of that docksite ?

 

ForExample.......

My view1 dispalyed in docksite1 as the tool window  and it is linked with my baseDocksite.

As i run the application, view1 will displayed in the docksite1 and initially it is in docked state and its height and widht are 1200(apprx.) and 165(apprx.) respectively and if i drag this view(toolwindow) from the docksite1then  can i call the WindowDragging handler for the docksite1 and can i reset the docked state size in that handler so that on hovering the mouse on the top position on dockguide of  basedocksite it hsows the less height or the height according to the  reset the docked state size .

[Modified 8 years ago]

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

You could use the DockSite.SetControlSizeForState method to try this.  We haven't tried it but it may work if you do it in WindowDragging.


Actipro Software Support

Posted 8 years ago by keshav bansal
Avatar

Hi,

I tried this DockSite.SetControlSizeForState method but its not resetting the docked state size of the toolwindow means intially my toolwindow is docked and it is linked with the basedocksite  and as i drag the toolwindow i m using DockSite.SetControlSizeForState(toolwindow,new Size*(100,100),DockingWindowState) in the windowDragging EventHandler and basedocksite displaying the dockguide and as i hover the mouse on the topdirection icon of the dockguide of the basedocksite after dragging the toolwindow,its shaded height is not showing according to the DockSite.SetControlSizeForState.

 As you clearly told in the above response,

The drop target size is based on several factors like available size and the last docked state size.

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

I just tried this in our Features demo by putting this code in a DockSite.WindowDragging event handler and it tried to show the drop targets as 300 wide and 100 high, even though it normally would attempt to dock at 200 wide and 200 high in the same scenario.

DockSite.SetControlSizeForState(toolWindows["solutionExplorerToolWindow"], new Size(300, 100), DockingWindowState.Docked);

So that appeared to work.


Actipro Software Support

Posted 7 years ago by keshav bansal
Avatar

Hi,

The above functionlity working for anly AutoHideLeftContainer or the AutoHideRightContainer windows.

On the DockSite.WindowDragging event handler

DockSite.SetControlSizeForState(toolWindows["DockSite Options"], new Size(50,50), DockingWindowState.Docked);

Its working but if i dock in the top(height 50 showing according to the above function) and again i dragg that window then its not showing according to the above function.

Please give some piece of code that shows the toolwindow in the single docksite1 linked to another docksite and if user drag the toolwindow from the docksite1 then call DockSite.WindowDragging event handler and shaded dockguide in  the another docksite displaying according to that function of DockSite.SetControlSizeForState.

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

Hi Keshav,

The control size gets updated by us any time you dock a tool window.  So it's not going to be persistent between dockings.  You'd need to set it again any time you start dragging it. 

Keep in mind that this whole thing is really isn't intended to be used how you are since we use that method to track desired sizes for verious states, but it's a possible feature you may be able to coerce for your needs a bit.


Actipro Software Support

Posted 7 years ago by keshav bansal
Avatar

Hi,

Simple docking application for the handling the windowDragging event and dynamically set the height of the dockguide for the dragged toolwindow.

<Grid>
<docking:DockSite x:Name="docksite1" Grid.Row="0" WindowDragging="docksite1_WindowDragging">
<docking:DockSite.AutoHideRightContainers>
<docking:ToolWindowContainer><docking:ToolWindow Title="SAMPLE4" Name="tw4"></docking:ToolWindow>
</docking:ToolWindowContainer>
</docking:DockSite.AutoHideRightContainers>
<docking:SplitContainer Orientation="Vertical">
<docking:ToolWindowContainer><docking:ToolWindow Title="SAMPLE1" Name="tw1"></docking:ToolWindow>
</docking:ToolWindowContainer>
<docking:ToolWindowContainer>
<docking:ToolWindow Title="SAMPLE5" Name="tw5"></docking:ToolWindow>
<docking:ToolWindow Title="SAMPLE6" Name="tw6"></docking:ToolWindow>
</docking:ToolWindowContainer>
</docking:SplitContainer>

</docking:DockSite>

</Grid>

private void docksite1_WindowDragging(object sender, RoutedEventArgs e)
{
List<ToolWindow> twlist = (sender as DockSite).ToolWindows.ToList();
foreach (ToolWindow t in twlist)
{
if (t.Title == "SAMPLE4")
DockSite.SetControlSizeForState(t, new Size(50,50), DockingWindowState.Docked);
if (t.Title == "SAMPLE6")
DockSite.SetControlSizeForState(t, new Size(50, 50), DockingWindowState.Docked);
if (t.Title == "SAMPLE5")
DockSite.SetControlSizeForState(t, new Size(50, 50), DockingWindowState.Docked);
if (t.Title == "SAMPLE1")
DockSite.SetControlSizeForState(t, new Size(50, 50), DockingWindowState.Docked);

}

}

For the above sample

Problem1

1. If i dragged the sample 4 which is inside the AutoHideRightContainer or  Sample6 or Sample5 toolwindow which are inside the toolwinodwcontainers and it shows the height for the dockguide at the top according to the setControlSizeForState.

2. If i dragged the sample 1 which is inside toolwinodwcontainers and its not  showing  the height for the dockguide at the top according to the setControlSizeForState. As the sample1 toolwindow is in the docked state.

Problem2: If i drag the toolwindow from the docksite and drop into the same docksite or another docksite then splitter somes with that drgged toolwindow.Can i hide this splitter whenever the user drag the toolwindow from the docksite and drop into the same docksite or another docksite .

[Modified 7 years ago]

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

Hi Keshav,

1) I believe when there is a single tool window in a container, it might be using the container's (t.ParentContainer) attached ControlSize value. So you'd need to call your methods on the containers as well.

I don't like that we're modifying these values since I fear that it may introduce other issues. Again, the ControlSize is more for our internal usage and isn't designed to be used for what you're trying to do.

2) No sorry, as we've told you in other previous threads, there isn't a way to turn off splitters.


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.