Different behavior of docking:DockSite.ControlSize

Docking/MDI for WPF Forum

Posted 14 years ago by Ujjwal Lahoti
Version: 10.1.0521
Platform: .NET 4.0
Environment: Windows XP (32-bit)
Avatar
docking:DockSite.ControlSize behavior is different when the parameter is specified for the docked panel or for a autoHide panel.

e.g. I have two panels, that I want to have same size. The one which is docked I need to provide a ControlSize of docking:DockSite.ControlSize="35, 100" (Height is irrelevant) to get desirable Width, and to get the same width for the AutoHide Panel I need to specify: docking:DockSite.ControlSize="300, 100".

As of result of this, when I autohide the Docked panel, and then expand the AutoHide panel by clicking the mouse, it opens really small (Width==35, compared to 300), making it unusable.

Any suggestions to fix this or a work around would really help.

Look at this pic: http://drop.io/zdunap1/asset/actipro-controsize-issues2-jpg

(In this PIC "Inst 1: RF Instruments" is shown in docked mode, and then in AutoHide expanded mode).

Comments (10)

Posted 14 years ago by Ujjwal Lahoti
Avatar
I have kind found a work around, by re-defining the ControlSize, when the controls AutoHide and when they Dock. Its workable for now. But I would like to understand the problem, and hope you fix it.
Posted 14 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Ujjwal,

I suspect that you are setting the ControlSize on the ToolWindow, when you should be setting it on the ToolWindowContainer. So, taking an excerpt from one of our samples, the code would be:
<docking:ToolWindowContainer docking:DockSite.ControlSize="500,500">
    <docking:ToolWindow x:Name="toolboxToolWindow" Title="Toolbox" ...>
        ...
    </docking:ToolWindow>
</docking:ToolWindowContainer>
But if that's not the case, please put together a small sample project that reproduces the issue and email it over to our support address. Be sure to remove any executable files from the archive.


Actipro Software Support

Posted 14 years ago by Ujjwal Lahoti
Avatar
I am setting the ControSize property on the ToolWidowContainer only. I will create a small project and mail it to you. I will have to create a project from scratch to remove all the extra code I have in there.
Posted 13 years ago by Bill L
Avatar
Hey,

Are we able to two-way bind to docking.DockSite.ControlSize in xaml?
I have tried this but it appears to only work in setting the initial size. Notifications back to the source when the toolwindow size is changed do not work.

Best regards,
Bill
Posted 13 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Bill,

The ControlSize property only affects the initial size of the window when it is displayed and is not intended for use with two-way bindings.


Actipro Software Support

Posted 13 years ago by Bill L
Avatar
Hey,

I suspect there isn't another dependency property to bind to or an event to attach to in a behavior in order to save the last used toolwindow/toolwindowcontainer size?

Best regards,

Bill
Posted 13 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Bill,

The closest event would probably be the ToolWindowContainer.SizeChanged event. This size is ultimately what is retained when saving/restoring a ToolWindow's size in it's various states.

Can explain a bit about what you are ultimately trying to do? Normally, you can save and restore a ToolWindow's position and size using our built in serialization support.


Actipro Software Support

Posted 13 years ago by Bill L
Avatar
Hey,

I am trying to store the last used size for auto-hide toolwindows in document windows that are not available for the normal serialization support. I have tried to attach a behavior to SizeChanged, but this only fires once during initialization and does not fire as a toolwindow size is changed afterwards.

Best regards,

Bill
Posted 13 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Bill,

The ToolWindow is only responsible for rendering it's tab, not it's content (except when contained in a standard MDI host). When docked, the ToolWindow's content is displayed by a ToolWindowContainer, which displays the content of the selected tab/ToolWindow.

You would need to listen to the SizeChanged event on the ToolWindowContainer. Keep in mind though that the ToolWindowContainer, along with SplitContainer and TabbedMdiContainer, are dynamically created/destroyed as windows are moved around the DockSite. So you can't simply attach a handler for the SizeChanged event to any ToolWindowContainers you define in your XAML. You'd have to use an implicit Style for the ToolWindowContainers type to apply an attached behavior, which would attach a handler for the SizeChanged event.


Actipro Software Support

Posted 13 years ago by Bill L
Avatar
Hey,

Thanks! The key was attaching the behavior in an implicit style for the ToolWindowContainer as it would not work with the ToolWindowContainer defined in xaml.

Best regards,

Bill
The latest build of this product (v24.1.2) was released 1 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.