Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
250
Detecting the pane drop location within the DocumentHost
posted

My XamDockManager has multiple documents in a tabbed DocumentHost, each of which has scrollable content within it. I'm trying to figure out a way to synchronize scrolling between two documents when they are drag/dropped next to each other either vertically or horizontally. Synchronizing the scrolling is the easy part, but first I need to figure out how to detect when the documents are aligned next to each other.

On the PaneDragEnded event I can check the PaneLocation of the dragged panes, but if the pane was dropped within the DocumentHost it will always just have the value of "document". Is there any way to detect where within the DocumentHost it was dropped (i.e. top, left, right, bottom)?

At this point I'm thinking about trying to compare x,y coordinates of all the panes in the DocumentHost in order to figure out their relative position. Is there a better way?

Parents
No Data
Reply
  • 54937
    Offline posted

    The DocumentContentHost supports complex nesting so I'm not sure what would be considered top/left/right/bottom. If you want to get information about where a pane is being dragged during a drag operation you can handle the PaneDragOver event and cast the e.DragAction to the relevant PaneDragAction derived class. Once the panes have been moved if you want to find out about where they are you would probably have to walk up the logical tree (i.e. using LogicalTreeHelper). In the DocumentContentHost, the logical parent of a ContentPane would be the TabGroupPane. The logical parent of that would be the SplitPane. The logical parent of that could be another splitpane or could be the DocumentContentHost. So for your purposes if 2 TabGroupPane instances have the same SplitPane parent then you can consider them aligned (either vertically or horizontally depending on that splitpane's SplitterOrientation).

Children
No Data