Stop resizing of toolwindows within docksite

Docking/MDI for WPF Forum

Posted 8 years ago by Bret Naughton
Version: 11.1.0543
Avatar
Hi,

I am creating a "reader" version of my application and would therefore like to stop various dashboard editing functions that are presented to the user.

All is now working but I cannot work out how to stop the user from resizing the various toolwindows in my dashboard/docksite.

I did look at the forum, and I think there was one thread where it described this functionality as something to be added in the future - wondered if this functionality was now included in the latest release.

Bret

Comments (12)

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

If you want to completely disable resizing you can use an implicit Style like so:
<Style TargetType="docking:ContainerSplitter">
    <Setter Property="IsEnabled" Value="False" />
</Style>
But we do not currently have support for fixed sized tool windows. I've added this post to that TODO item, so you'll be notified when it's completed.


Actipro Software Support

Posted 7 years ago by Bret Naughton
Avatar
I have quick question concerning my setting of the containersplitter to disable resizing.

Currently I create all my docksites/toolwindows in code. I am actually using the Inner-Fill method for being able to automatically do an automatic best fit on all the toolwindows within the docksite. And I also nest toolwindows (and therefore there parent docksites within parent toolwindows).

I am now having to switch the ability for a user being able to dynamically resize the toolwindows based on the current permissions available (full version / reader only version of my application).

In order to do this programmatically, do I have to loop through all of the docksites/toolwindows and for each, find the relevant splitters and set to 'IsEnabled=False'.

As mentioned, the setting are having to be done on the fly programmatically. Sorry for he confusion on this if I have not understood the above.

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

Yes your assumption is correct.


Actipro Software Support

Posted 7 years ago by Bret Naughton
Avatar
Thanks that works great.

Bret
Posted 7 years ago by keshav bansal
Avatar

Hi,

As Mentioned by the Bret Naughton in above post. 

In order to do this programmatically, do I have to loop through all of the docksites/toolwindows and for each, find the relevant splitters and set to 'IsEnabled=False'.

How to get the docksites/toolwindows and for each, find the relevant splitters....?

 

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

You already know which DockSites you have and each has a ToolWindows collection.  So you could iterate through those and look at the ParentContainer properties.  Then continue iterating up the Parent hierarchy to look for SplitContainers.

Or you could start at your DockSite and run down through its Content, which could be a container.  If it's a SplitContainer, use VisualTreeHelper to find the ContainerSplitters in it and disable them.  Then recurse down further.


Actipro Software Support

Posted 7 years ago by keshav bansal
Avatar

Hi,

I am able to get the SplitterContainer from the toolwindowcollection of the docksite and also able to apply the IsEnabled property to false.

But the other functionality breks.

Suppose i have usercontrol1 is hosted as the toolwindow which is in the above toolwindowcollection and i am also having the MouseDown event in the button of the usercontrol.So i disabled the Splittercontainer and then i am not able to get the debug point on the Mousedown event  of the usercontrol ie. in the Splittercontainer.

So how to get only  Splitter from the splittercontainer and the then set the splitter.Isenabled to false. 

I can't use the Visual TreeHelper because i am hosting the usercontrol as the toolwindow in the docksite and the container ie. either SpliContainer or the ContainerSplitters are automatically created . 

[Modified 7 years ago]

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

Hi Keshav,

I think you have it wrong, you don't want SplitContainer.  That is the container and disabling that will disable all child controls.  You want the ContainerSplitter controls within the SplitContainer.

You can use VisualTreeHelper methods at any time on a visual once the visuals have been created (generally after its template has been applied).  It doesn't matter if the container is automatically created or not.  Once it's loaded, you can use VisualTreeHelper on it.


Actipro Software Support

Posted 7 years ago by keshav bansal
Avatar

Hi,

I am not able to get the ContainerSplitter from the SplitContainer using the VisualTreeHelper.

Code used is :

VisualTreeHelper.GetParent(splitContainer);

or

VisualTreeHelper.GetChild(splitContainer);

So please provide some line of code that gets the ContainerSplitter from the SplitContainer using the VisualTreeHelper.

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

Hi Keshav,

It's easy, code like this shows the visual children and I see ContainerSplitters in there:

var count = VisualTreeHelper.GetChildrenCount(split);
for (var i = 0; i < count; i++) {
	var ele = VisualTreeHelper.GetChild(split, i);
	Console.WriteLine(i + ": " + ele);
}


Actipro Software Support

Posted 7 years ago by keshav bansal
Avatar

Hi,

I am get the zero value for the  code as specified above.

var count = VisualTreeHelper.GetChildrenCount(split);

so i am not able to get the ContainerSplitter form the splitContainer.

Thats y i am not able to set the style for disabling the ContainerSplitter because style always applys on the ContainerSplitter not on SplitContainer.

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

Sorry, I'm not sure what to tell you except make sure you run the code I posted above on a SplitContainer (in my case in the variable named split), and do so after the layout has been loaded.  It worked fine for me.  If you get zero results you are either looking at the wrong element or are doing it before the layout has loaded.


Actipro Software Support

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.