ソースを参照

Fixing bugs with Dataentry panel

Kenric Nugteren 5 ヶ月 前
コミット
64df47dd93
1 ファイル変更9 行追加10 行削除
  1. 9 10
      prs.desktop/Panels/DataEntry/DataEntryPanel.xaml.cs

+ 9 - 10
prs.desktop/Panels/DataEntry/DataEntryPanel.xaml.cs

@@ -245,12 +245,6 @@ public partial class DataEntryPanel : UserControl, IBasePanel, IDynamicEditorHos
         Editor.SetValue(Grid.ColumnProperty, 0);
         Editor.SetValue(Grid.ColumnSpanProperty, 4);
 
-        Editor.OnAfterEditorValueChanged += (sender, args) =>
-        {
-            IsChanged = IsChanged || (_entity?.IsChanged() == true || _originalID != _entityID);
-            return null;
-        };
-
         Editor.OnOK += () => { DoSave(false); };
         Editor.OnCancel += () =>
         {
@@ -258,7 +252,10 @@ public partial class DataEntryPanel : UserControl, IBasePanel, IDynamicEditorHos
             Select(_selectedType,_entityID);
         };
         Editor.OnChanged += (sender, args) => IsChanged = true;
-        Editor.OnFormCustomiseEditor += (sender, items, column, editor) =>
+        
+        DetailBorder.Child = Editor;
+        _grid = (DynamicGridUtils.CreateDynamicGrid(typeof(DynamicDataGrid<>), _selectedType) as IDynamicDataGrid)!;
+        _grid.OnCustomiseEditor += (sender, items, column, editor) =>
         {
             if ((editor is BaseCodeEditor be) && editor.Editable.EditorVisible())
             {
@@ -268,9 +265,11 @@ public partial class DataEntryPanel : UserControl, IBasePanel, IDynamicEditorHos
                 };
             }
         };
-        
-        DetailBorder.Child = Editor;
-        _grid = DynamicGridUtils.CreateDynamicGrid(typeof(DynamicDataGrid<>), _selectedType) as IDynamicDataGrid;
+        _grid.OnAfterEditorValueChangedEvent += (sender, args) =>
+        {
+            IsChanged = IsChanged || (_entity?.IsChanged() == true || _originalID != _entityID);
+            return null;
+        };
 
         if (_grid is DynamicDataGrid<JobDocumentSetMileStone> milestoneGrid)
         {