diff --git a/Perspex.Controls/Panel.cs b/Perspex.Controls/Panel.cs index 2a35bb7267..170c8fa3e6 100644 --- a/Perspex.Controls/Panel.cs +++ b/Perspex.Controls/Panel.cs @@ -57,7 +57,6 @@ namespace Perspex.Controls this.ClearVisualChildren(); this.children.Clear(); this.children.AddRange(value); - this.LogicalChildren.AddRange(value); } } diff --git a/Tests/Perspex.Controls.UnitTests/PanelTests.cs b/Tests/Perspex.Controls.UnitTests/PanelTests.cs index d2c7c4d880..9d3dce7a7e 100644 --- a/Tests/Perspex.Controls.UnitTests/PanelTests.cs +++ b/Tests/Perspex.Controls.UnitTests/PanelTests.cs @@ -84,6 +84,18 @@ namespace Perspex.Controls.UnitTests Assert.Null(child2.GetLogicalParent()); } + [Fact] + public void Setting_Children_Should_Make_Controls_Appear_In_Panel_Children() + { + var panel = new Panel(); + var child = new Control(); + + panel.Children = new Controls { child }; + + Assert.Equal(new[] { child }, panel.Children); + Assert.Equal(new[] { child }, panel.GetLogicalChildren()); + } + [Fact] public void Child_Control_Should_Appear_In_Panel_Children() {