This project is read-only.

[Version 2.0] Dock/Undock/Float properties/events? What to catch or observe?

Oct 15, 2012 at 8:39 AM

Hello my friends.

I have tried to learn by myself, but I found out I'm unable to intercept the moment in which a LayoutAnchorable or Document is anchored of set it to float over.

I have an LayoutAnchorable that host a toolbar of which its rows/columns change when floating around.

Thanks a lot for your help.

Oct 18, 2012 at 6:21 PM

I think the author is away for some reason. Has anybody figured out how some event or property (and when to check them) that indicates the current docking state? docked (horizontally? vertically?), floating...?

Oct 18, 2012 at 8:39 PM

Hi, I'm afraid that such events are not available in current version, I'll work to add them in the short time.
Just curious, why the toolbar should have a different behavior when floating inside a window?

Thx, Ado

Oct 18, 2012 at 10:15 PM

Hi adospace! and thanks a lot for your interest. As soon as you replied I though of a possible solution for my problem.

I have a toolbar that adapts to the available space, having its tools either arranged in ONE column or a row, depending on which side it's docked into. Well, I supposed this could be detected, but you told me it's not possible, at least for the moment.

Soon after I read you I thought about intercepting the Layout or SizeChanged events to swicth rows / columns in the panel that contains the tools (that is placed into a LayoutAnchorable).

I haven't tried yet, but I think it will give me good results :) By the way, CONGRATS for AvalonDock. It's a great piece of software with a lot of potential. I saw a lot of spectation and audience in the forums, although the support has been very sporadic lately.

I eagerly wait for documentation for 2.0. I'm new to this, but the MVVM approach is the HIT.

THANKS again and please, go on. My team and I really appreciate your work.

Nov 1, 2012 at 4:51 AM
adospace wrote:

Hi, I'm afraid that such events are not available in current version, I'll work to add them in the short time.
Just curious, why the toolbar should have a different behavior when floating inside a window?

Thx, Ado

Hi Ado

I also have a need for some kind of event/property-changed notification when a document is undocked/docked and would like to also vote for this feature.

I need this to subscribe to the Window.LocationChanged event when the window containing the document is moved (to recompute absolute screen coordinates). When the document is undocked, I therefore need to be able to move the LocationChanged event handler to the floating window instead of the main app window (and back again when redocked).

NOTE: I used to be able to detect this reparenting with AvalonDock 1.3 by subscribing to the "ContainerPane" PropertyChanged event. 

BTW Is there a way to find the actual window that a document is hosted in? At the moment if I call Window.GetWindow(view) on my document model view instance, it always returns the application window, even if the document is floating! Any idea why this is?

Thanks for any help you can provide and keep up the amazing work!

Scott

Dec 3, 2012 at 4:47 PM

I also would really appreciate some kind of notification on a state change for a window.

My app has a diverse user base and some of the users require very large fonts - to accommodate this I use a scaletransform on the layoutroot hosting the docking manager. This works great for all visual descendants of the main window - blowing them up to easy to see sizes (including menubar, docked toolwindows, and documents.  Where it fails is in floating windows - as they are no longer descendants they do not receive the transform.  I'd like to hook into a statechanged notification and check if the window is floating, if so, I'd apply a new transform to it to adjust the size to match the main window.

 

As we currently can't tie into a state changed notification, I'd really appreciate some alternative suggestions on how to accomplish this if any ideas come to mind.

 

Cheers,

Tim

Dec 17, 2012 at 10:59 AM

For the moment, the only (sure) way I found to handle docking state change of layout elements is to handle the DockingManager.LayoutUpdated. It's not really optimized, and I also wait for another events.