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
355
Drag drop in canvas within splitpane
posted

I have a canvas within a DocumentContentHost within a SplitPane.  I am dragging and dropping objects within the canvas.  it all works fine... but, i want to cancel the drag whenever the object is dragged out of the bounds of the canvas.  I have tried to use the previewdragleave event on the canvas, but, it doesn't seem to fire.  So, I am trying to cancel the drag within the PreviewMouseMove event.

So, how do i get the "bounds" of the SplitPane that the canvas is a child of?  I have tried variations of this:

bounds = VisualTreeHelper.GetDescendantBounds(xamMainDockMgr.ActivePane) and the Left and Top properties (x,y) are always 0,0.  The Right property is the actualwidth and the Bottom property is the actualheight.  Bascially, I have tried using the VisualTreeHelper with all of the container objects within my xamDockManager and they all seem to return the same.  I also get the same whenever i try to use the Canvas.GetLeft method.  I realize the canvas is a child and would be considered at 0,0 within the parent, but, why are all the parent(s) also returning 0,0?

I will need to be able to capture the boundaries at runtime since the user can move (unpin, etc) the docked panel.  Any ideas?  it must be something easy i am just missing it.