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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user