B2022-044: Search results scrolling in long lists repositions after edit

This commit is contained in:
Kathy Ruffing 2022-04-12 12:29:41 +00:00
parent 3de3252f1b
commit 7d6667c423

View File

@ -78,6 +78,10 @@ namespace Volian.Controls.Library
if (value != null) // Don't select an item from the list when it is updated
_SearchResults.ListChanged += new ListChangedEventHandler(_SearchResults_ListChanged);
DisplayResults();
// B2022-044: don't set selection to top of list (commented out/changed if). Remove event that does this
// after results are displayed. Without this, the code in _SearchResults_ListChanged was run upon selections
if (value != null)
_SearchResults.ListChanged -= new ListChangedEventHandler(_SearchResults_ListChanged);
}
}
void _SearchResults_ListChanged(object sender, ListChangedEventArgs e)
@ -1225,9 +1229,11 @@ namespace Volian.Controls.Library
ListBox mylb = sender as ListBox;
// If the list is being refreshed, then set the selection index to -1 (no selection)
if (mylb != null && _SearchResults.RefreshingList && mylb.SelectedIndex != -1)
mylb.SelectedIndex = -1;
else
// B2022-044: don't set selection to top of list (commented out/changed if)
//if (mylb != null && _SearchResults.RefreshingList && mylb.SelectedIndex != -1)
// //mylb.SelectedIndex = -1;
//else
if (mylb != null && !_SearchResults.RefreshingList)
{
_ItemInfo = (tabSearchTypes.SelectedTab == tabSearchTypes.Tabs[4]) ? lbSrchResultsIncTrans.SelectedValue as ItemInfo : lbSrchResults.SelectedValue as ItemInfo;
if ((tabSearchTypes.SelectedTab == tabSearchTypes.Tabs[1]) && (_ItemInfo != null))