Auto-Hide/Dock two windows in Sync

Docking/MDI for WPF Forum

Posted 9 years ago by Ujjwal Lahoti
Avatar
I have two Docked windows on the Left and Right side of my GUI (Similar to Visual Studio: Solution Explorer on the Left, Properties on the Right). I want to do the following

1. If I auto-hide the window on the left, it should auto-hide the window on the Right as well (and vice-versa)
2. If I dock the window on the left, it should dock the window on the right as well (and vice-versa)
3. If the windows are in Auto-Hide mode, and if the user clicks on the auto-hide window on left, the auto-hide window on the right should also expand, and when lost focus. Both should hide at the same time.

Thanks in advance.

Comments (3)

Posted 9 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Ujjwal,

To accomplish #1 and #2, you would need to know when the state of one of the ToolWindows change. We currently have a TODO item to add a "state changed" event, which hasn't been implemented yet. I've added this forum post to that TODO item, so you will be notified when it is implemented.

You might be able to create a class that derives from ToolWindow, and override the StateProperty metadata. Then you'd need to add a property value changed handler, and sync your two ToolWindows (i.e. if one is docked, dock the other).

I don't believe you'll be able to accomplish #3, as the auto-hide host only uses 1 popup used to show auto-hidden windows.


Actipro Software Support

Posted 9 years ago by Ujjwal Lahoti
Avatar
For the Items #1 and #2, the ToolWindowContainer has an event: PropertyChanged. I tried to use it, however its behavior is very erratic. The event is fired when the Window is docked/AutoHide first couple of times. After that the event stops firing.

Can you provide a small project that demonstrates your suggestion?

About my request to accomplish #3, will creating multiple Docksites, and posting MouseEnter and MouseLeave events to other Window...., would work. Just a thought, wanted your input on it?
Posted 9 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hello,

The DockingWindowContainer implements INotifyPropertyChanged, which defines the PropertyChanged event. It uses that event to notify WPF's binding system that certain non-dependency properties have changed. This event is not fired for dependency properties.

You may be able to accomplish #3 using two DockSites, but we have never tried that. There will probably be several hurdles related to it.

Unfortunately, we can't provide a small project, but would be happy to help as you run into issues. The basic idea is outlined here though: http://msdn.microsoft.com/en-us/library/ms754209.aspx

They use PropertyMetadata, but you would need to use FrameworkPropertyMetadata and add a change handler.


Actipro Software Support

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.