From b94f9bbc152c611f4cfbfa8a677616f7d5579991 Mon Sep 17 00:00:00 2001 From: Mbucari Date: Tue, 18 Jul 2023 16:11:22 -0600 Subject: [PATCH] Fix grid update bug --- Source/LibationWinForms/GridView/ProductsGrid.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Source/LibationWinForms/GridView/ProductsGrid.cs b/Source/LibationWinForms/GridView/ProductsGrid.cs index 2d7f653c..790f5ba0 100644 --- a/Source/LibationWinForms/GridView/ProductsGrid.cs +++ b/Source/LibationWinForms/GridView/ProductsGrid.cs @@ -362,12 +362,17 @@ namespace LibationWinForms.GridView seriesEntry.UpdateLibraryBook(seriesBook); } + //Series entry must be expanded so its child can + //be placed in the correct position beneath it. + var isExpanded = seriesEntry.Liberate.Expanded; + bindingList.ExpandItem(seriesEntry); + //Add episode to the grid beneath the parent int seriesIndex = bindingList.IndexOf(seriesEntry); int episodeIndex = seriesEntry.Children.IndexOf(episodeEntry); bindingList.Insert(seriesIndex + 1 + episodeIndex, episodeEntry); - if (seriesEntry.Liberate.Expanded) + if (isExpanded) bindingList.ExpandItem(seriesEntry); else bindingList.CollapseItem(seriesEntry);