Browse Source

fixed bug in panel controls when they are set with the same collection instance

donandren 8 years ago
parent
commit
60ff3b8e4a
1 changed files with 6 additions and 3 deletions
  1. 6 3
      src/Avalonia.Controls/Panel.cs

+ 6 - 3
src/Avalonia.Controls/Panel.cs

@@ -64,9 +64,12 @@ namespace Avalonia.Controls
             {
                 Contract.Requires<ArgumentNullException>(value != null);
 
-                VisualChildren.Clear();
-                _children.Clear();
-                _children.AddRange(value);
+                if (_children != value)
+                {
+                    VisualChildren.Clear();
+                    _children.Clear();
+                    _children.AddRange(value);
+                }
             }
         }