From bca8c3865b3fce2af63ae6b2ff1f106e42063d5e Mon Sep 17 00:00:00 2001 From: Robert McRackan Date: Tue, 26 Apr 2022 16:37:13 -0400 Subject: [PATCH] Expose a way to insert ad hoc library books to grid --- LibationWinForms/ProductsGrid.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/LibationWinForms/ProductsGrid.cs b/LibationWinForms/ProductsGrid.cs index 0fc13de5..0cb7d96b 100644 --- a/LibationWinForms/ProductsGrid.cs +++ b/LibationWinForms/ProductsGrid.cs @@ -107,6 +107,11 @@ namespace LibationWinForms #endregion + private SortableBindingList bindingList; + + /// Insert ad hoc library books to top of grid + public void AddToTop(DataLayer.LibraryBook libraryBook) => bindingList.Insert(0, new GridEntry(libraryBook)); + #region UI display functions private bool hasBeenDisplayed = false; @@ -145,7 +150,8 @@ namespace LibationWinForms .ToList(); // BIND - gridEntryBindingSource.DataSource = new SortableBindingList(orderedGridEntries); + bindingList = new SortableBindingList(orderedGridEntries); + gridEntryBindingSource.DataSource = bindingList; // FILTER Filter();