Browse Source

Fix to CustomiseEditor function.

Kenric Nugteren 5 tháng trước cách đây
mục cha
commit
dd9ad1587e

+ 3 - 1
inabox.wpf/DynamicGrid/Grids/BaseDynamicGrid.cs

@@ -1409,7 +1409,9 @@ public abstract class BaseDynamicGrid : ContentControl, IDynamicGridUIComponentP
             DoAdd();
     }
 
-    BaseEditor IDynamicGridUIComponentParent.CustomiseEditor(DynamicGridColumn column, BaseEditor editor)
+    BaseEditor IDynamicGridUIComponentParent.CustomiseEditor(DynamicGridColumn column, BaseEditor editor) => CustomiseEditor(column, editor);
+
+    protected virtual BaseEditor CustomiseEditor(DynamicGridColumn column, BaseEditor editor)
     {
         return editor.CloneEditor();
     }

+ 2 - 8
inabox.wpf/DynamicGrid/Grids/DynamicGrid.cs

@@ -309,7 +309,7 @@ public abstract class DynamicGrid<T> : BaseDynamicGrid, IDynamicGridUIComponentP
         return result;
     }
 
-    protected override void ReloadData(CancellationToken token, Action<CoreTable?, Exception?> action)
+    protected sealed override void ReloadData(CancellationToken token, Action<CoreTable?, Exception?> action)
     {
         _lookupcache.Clear();
 
@@ -557,13 +557,6 @@ public abstract class DynamicGrid<T> : BaseDynamicGrid, IDynamicGridUIComponentP
         AfterLoad(editor, items);
     }
     
-    // BaseEditor IDynamicGridUIComponentParent<T>.CustomiseEditor(DynamicGridColumn column, BaseEditor editor)
-    // {
-    //     var result =  editor.CloneEditor();
-    //     CustomiseEditor(new T[] { }, column, result);
-    //     return result;
-    // }
-    
     private void DoCustomiseEditor(IDynamicEditorForm sender, object[] items, DynamicGridColumn column, BaseEditor editor)
     {
         CustomiseEditor(sender, (T[])items, column, editor);
@@ -572,6 +565,7 @@ public abstract class DynamicGrid<T> : BaseDynamicGrid, IDynamicGridUIComponentP
 
     protected virtual void CustomiseEditor(IDynamicEditorForm form, T[] items, DynamicGridColumn column, BaseEditor editor)
     {
+        CustomiseEditor(column, editor);
     }
 
     protected virtual void DoAfterSave(IDynamicEditorForm editor, T[] items)