瀏覽代碼

Updating the OnReconfigure event on DynamicGrid now reconfigures the options.

Kenric Nugteren 7 月之前
父節點
當前提交
85faaf5a96
共有 1 個文件被更改,包括 15 次插入2 次删除
  1. 15 2
      inabox.wpf/DynamicGrid/DynamicGrid.cs

+ 15 - 2
inabox.wpf/DynamicGrid/DynamicGrid.cs

@@ -106,7 +106,20 @@ public abstract class DynamicGrid<T> : DynamicGrid, IDynamicGridUIComponentParen
 
     #region Events
 
-    public event IDynamicGrid.ReconfigureEvent? OnReconfigure;
+    private event IDynamicGrid.ReconfigureEvent? _onReconfigure;
+    public event IDynamicGrid.ReconfigureEvent? OnReconfigure
+    {
+        add
+        {
+            _onReconfigure += value;
+            Reconfigure();
+        }
+        remove
+        {
+            _onReconfigure -= value;
+            Reconfigure();
+        }
+    }
 
     public OnGetDynamicGridRowStyle? OnGetRowStyle { get; set; }
     
@@ -747,7 +760,7 @@ public abstract class DynamicGrid<T> : DynamicGrid, IDynamicGridUIComponentParen
 
     protected void OnReconfigureEvent(DynamicGridOptions options)
     {
-        OnReconfigure?.Invoke(options);
+        _onReconfigure?.Invoke(options);
     }
 
     /// <summary>