[Version 2.0] public DockingManager.StartDraggingFloatingWindowForPane?

Jun 13, 2012 at 7:34 PM

I have a requirement to open a control in a new floating window.  After poking around in the source I saw that in DockingManager.StartDraggingFloatingWindowForPane, how you do it is pretty straight-forward.  The problem is that LayoutAnchorableFloatingWindowControl is internal as is DockingManager.StartDraggingFloatingWindowForPane

There doesn't seem to be an easy way to create a new floating window.

Just for test purposes I changed DockingManager.StartDraggingFloatingWindowForPane to public, built and did the following:

LayoutAnchorablePane pane = new LayoutAnchorablePane();
LayoutAnchorable la = new LayoutAnchorable();
TextBox txtBx = new TextBox();
txtBx.Text = "Test";
la.Content = txtBx;
pane.Children.Add(la);
DockManager.StartDraggingFloatingWindowForPane(pane);

and it worked magically great.

Am I missing some easy way to open a new window or is there a reason why DockingManager.StartDraggingFloatingWindowForPane is internal?

Jun 13, 2012 at 8:00 PM

I had some problems with portions of the code expecting a previous container.  I changed LayoutContent.ILayoutContainer.PreviousContainer from internal to public. I named one of my LayoutAnchorablePanes in my app to paneDefault and did the following:

LayoutAnchorablePane pane = new LayoutAnchorablePane();
LayoutAnchorable la = new LayoutAnchorable();
TextBox txtBx = new TextBox();
txtBx.Text = "Test";
la.Content = txtBx;
la.PreviousContainer = paneDefault;
pane.Children.Add(la);
DockManager.StartDraggingFloatingWindowForPane(pane);

Now everything seems to be working as I would have expected it.  Again, I'm hoping that rather then requesting a change from internal to public on a bunch of stuff there is just some way I'm doing things wrong.

Jun 13, 2012 at 9:33 PM

You can float a LayoutContent calling its Float() method (which does pretty much what you have already done by your self) and re-dock it with Dock() or DockAsDocument(),

ado

Jun 13, 2012 at 10:47 PM

That got me close but for some reason in Focus(), the Manager on the Root was null (even after setting the parent).  Setting the Manager.Layout to LayoutRoot hooked things back together.

LayoutAnchorable la = new LayoutAnchorable{Title="Test"};
TextBox txtBx = new TextBox();
txtBx.Text = "Test";
txtBx.Name = "txtBx";
la.Content = txtBx;
//this doesn't seem to have any effect
paneDefault.Children.Add(la);
//for some reason the existing DockManager.LayoutRoot != layoutRoot
//but paneDefault.Root == layoutRoot
DockManager.LayoutRoot = layoutRoot;
//set parent so float can find it's root
la.Parent = paneDefault;
la.Float();

When calling Float() I was getting a null pointer exception.  Float uses Parent to find the Root (which I've set above).  The problem is that for some odd reason the Manager on my Root was null and thus cannot could not call StartDraggingFloatingWindowForContent.  

As stated above, for some reason the existing DockManager.LayoutRoot != layoutRoot but paneDefault.Root == layoutRoot.  I debugged it for a bit but I'm not seeing anything obvious how these could have disconnected.

 

Thanks for the help.

Brian

Jun 13, 2012 at 11:07 PM
FormatException wrote:

As stated above, for some reason the existing DockManager.LayoutRoot != layoutRoot but paneDefault.Root == layoutRoot.  I debugged it for a bit but I'm not seeing anything obvious how these could have disconnected.

This is because of all the deserialization I do that somewhere something broke.

The flow basically goes like this:

  1. Launch App
  2. OnLoad, deserialize a default layout.
  3. See if the user has a previously saved layout 
    • if so deserialize that layout.

If I take out the two deserialize(s?) after launch then everything works as expected and DockManager.Layout == layoutRoot == paneDefault.Root.  This seems to me like a potential for some serious problems.

 

Thanks,
Brian 

Jun 13, 2012 at 11:12 PM

Do you have a sample project that you can post here? I'm curious to see what causes the problem,thx

Jun 13, 2012 at 11:27 PM

I'll throw together a simple project and see if I can't duplicate my issue.

Jun 14, 2012 at 12:32 AM

I have created a work item (http://avalondock.codeplex.com/workitem/15278) and posted the project there.

 

Thanks,
Brian