This project has moved and is read-only. For the latest updates, please go here.

AvalonDock: Creating a floating window from a hidden item does not appear to be working properly


I'm trying to create a new floating window by wrapping something in Layout.Hidden but it's not working as expected.

I've tried using an approach like this:
LayoutAnchorableFloatingWindow f = new LayoutAnchorableFloatingWindow();
LayoutAnchorablePane ap = new LayoutAnchorablePane(item);
f.RootPanel = new LayoutAnchorablePaneGroup(ap);
But the window never appears. The window does show in the ctrl-tab list and it does get serialized out.

Only if I reserialize the layout does the floating window appear.

What needs to be done to get this to work properly?


theficus wrote Jun 28, 2017 at 7:56 PM

To work around this I needed to code in a complete hack. I'm hoping there's a better way to do this.
LayoutAnchorableFloatingWindow lfw = new LayoutAnchorableFloatingWindow();
LayoutAnchorablePane lap = new LayoutAnchorablePane(layoutAnchorable);
lap.Parent = lfw;
lfw.RootPanel = new LayoutAnchorablePaneGroup(lap);
lfw.Parent = dm.Layout;                    
// Hack
LayoutAnchorableFloatingWindowControl lfwc = (LayoutAnchorableFloatingWindowControl)Activator.CreateInstance(typeof(LayoutAnchorableFloatingWindowControl), BindingFlags.NonPublic | BindingFlags.Instance, null, new object[] { lfw }, CultureInfo.InvariantCulture);
lfwc.Width = 300;
lfwc.Height = 300;
lfwc.Topmost = true;