Steps to reproduce:
- Create a window with a single LayoutDocument and 3 LayoutAnchorables.
- Dock one LayoutAnchorable to the side of the DockingManager (in a LayoutAnchorablePane).
- Drag the other two LayoutAnchorables into a single FloatingWindow, docked side by side.
- Drag the FloatingWindow and dock to the side of the first LayoutAnchorable.
- One of the floating LayoutAnchorables will disappear.
Code:
AnchorablePaneDropTarget.cs
protected override void Drop(LayoutAnchorableFloatingWindow floatingWindow)
{
// ... some code
for (int i = 0; i < layoutAnchorablePaneGroup.Children.Count; i++)
parentModel.InsertChildAt(insertToIndex + 1 + i, layoutAnchorablePaneGroup.Children[i]);
// ... some code
}
When a child of layoutAnchorablePaneGroup is inserted into parentModel it is removed from the layoutAnchorablePaneGroup children, so i is no longer at the correct index. A better solution is to use a while loop:
protected override void Drop(LayoutAnchorableFloatingWindow floatingWindow)
{
// ... some code
insertToIndex++;
while (layoutAnchorablePaneGroup.Children.Count > 0)
parentModel.InsertChildAt(insertToIndex++, layoutAnchorablePaneGroup.Children[0]);
// ... some code
}
This code appears in 4 different switch cases in the method.
Comments: ** Comment from web user: ikarthikb **
- Create a window with a single LayoutDocument and 3 LayoutAnchorables.
- Dock one LayoutAnchorable to the side of the DockingManager (in a LayoutAnchorablePane).
- Drag the other two LayoutAnchorables into a single FloatingWindow, docked side by side.
- Drag the FloatingWindow and dock to the side of the first LayoutAnchorable.
- One of the floating LayoutAnchorables will disappear.
Code:
AnchorablePaneDropTarget.cs
protected override void Drop(LayoutAnchorableFloatingWindow floatingWindow)
{
// ... some code
for (int i = 0; i < layoutAnchorablePaneGroup.Children.Count; i++)
parentModel.InsertChildAt(insertToIndex + 1 + i, layoutAnchorablePaneGroup.Children[i]);
// ... some code
}
When a child of layoutAnchorablePaneGroup is inserted into parentModel it is removed from the layoutAnchorablePaneGroup children, so i is no longer at the correct index. A better solution is to use a while loop:
protected override void Drop(LayoutAnchorableFloatingWindow floatingWindow)
{
// ... some code
insertToIndex++;
while (layoutAnchorablePaneGroup.Children.Count > 0)
parentModel.InsertChildAt(insertToIndex++, layoutAnchorablePaneGroup.Children[0]);
// ... some code
}
This code appears in 4 different switch cases in the method.
Comments: ** Comment from web user: ikarthikb **
Am on AvalonDock 2.0. I think am seeing a similar behavior. Were you guys able to fix this?
I would appreciate any urgency shown in this regard since we are dealing with issue in production.
Thanks
Kay