Browse Source

fix issue #3155 add/remove grid child runtime works properly

Andrey Kunchev 6 years ago
parent
commit
d478572e74
1 changed files with 10 additions and 0 deletions
  1. 10 0
      src/Avalonia.Controls/Grid.cs

+ 10 - 0
src/Avalonia.Controls/Grid.cs

@@ -6,6 +6,7 @@
 using System;
 using System.Collections;
 using System.Collections.Generic;
+using System.Collections.Specialized;
 using System.Diagnostics;
 using System.Linq;
 using System.Threading;
@@ -571,6 +572,15 @@ namespace Avalonia.Controls
             return (arrangeSize);
         }
 
+        /// <summary>
+        /// <see cref="Panel.ChildrenChanged"/>
+        /// </summary>
+        protected override void ChildrenChanged(object sender, NotifyCollectionChangedEventArgs e)
+        {
+            CellsStructureDirty = true;
+            base.ChildrenChanged(sender, e);
+        }
+
         /// <summary>
         /// Invalidates grid caches and makes the grid dirty for measure.
         /// </summary>