From 3e23ca9a1623acd289eb759fbe5c1e29a4f5902b Mon Sep 17 00:00:00 2001 From: Curtis Wensley Date: Mon, 17 Jul 2023 14:08:40 -0700 Subject: [PATCH] Wpf: Ensure TreeGridItem is expandable before checking if Expanded is true --- src/Eto.WinForms/CustomControls/TreeController.cs | 2 +- src/Eto.Wpf/Forms/Controls/TreeGridViewHandler.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Eto.WinForms/CustomControls/TreeController.cs b/src/Eto.WinForms/CustomControls/TreeController.cs index 8fcd357e8..39f0979c8 100644 --- a/src/Eto.WinForms/CustomControls/TreeController.cs +++ b/src/Eto.WinForms/CustomControls/TreeController.cs @@ -76,7 +76,7 @@ void ResetSections() for (int row = 0; row < Store.Count; row++) { var item = Store[row]; - if (item.Expanded) + if (item.Expandable && item.Expanded) { var children = (ITreeGridStore)item; var section = new TreeController { StartRow = row, Handler = Handler, parent = this }; diff --git a/src/Eto.Wpf/Forms/Controls/TreeGridViewHandler.cs b/src/Eto.Wpf/Forms/Controls/TreeGridViewHandler.cs index 4ef7fd124..851751ff5 100755 --- a/src/Eto.Wpf/Forms/Controls/TreeGridViewHandler.cs +++ b/src/Eto.Wpf/Forms/Controls/TreeGridViewHandler.cs @@ -240,7 +240,7 @@ protected override DragEventArgs GetDragEventArgs(sw.DragEventArgs data, object { position = GridDragPosition.After; var treeGridItem = item as ITreeGridItem; - if (treeGridItem?.Expanded == true) + if (treeGridItem?.Expandable == true && treeGridItem?.Expanded == true) { // insert as a child of the parent parent = item;