fix: address code quality issues in DockContainer and DockPanel

- Throw ArgumentException in DockContainer.ReplaceChild if newChild is already in the container to avoid index shifting bugs.
- Add comment in DockPanel.CheckCleanup explaining the asymmetric root panel collapse behavior.
This commit is contained in:
2026-03-28 22:46:26 +09:00
parent e6d0529ef1
commit 0f0b36a932
2 changed files with 6 additions and 5 deletions

View File

@@ -61,6 +61,9 @@ public class DockPanel : DockContainer
}
else if (Root != null && Root.RootPanel == this)
{
// We only collapse the root panel if the child is also a DockPanel
// because DockingLayout.RootPanel is strongly typed as DockPanel,
// so we can't assign a DockGroup to it directly.
if (child is DockPanel childPanel)
{
RemoveChildInternal(childPanel, false);