From 2f423539167388290799ce965561e8a7c4bb5735 Mon Sep 17 00:00:00 2001 From: yangshengf <31492969+yangshengf@users.noreply.github.com> Date: Sat, 6 Nov 2021 17:50:52 -0700 Subject: [PATCH] Reset Glyph when Import and Export List is Refreshed --- DependenciesGui/DependencyExportList.xaml.cs | 5 +++++ DependenciesGui/DependencyImportList.xaml.cs | 5 +++++ DependenciesGui/DependencyWindow.xaml.cs | 4 +++- DependenciesGui/GridViewSort.cs | 10 ++++++++++ 4 files changed, 23 insertions(+), 1 deletion(-) diff --git a/DependenciesGui/DependencyExportList.xaml.cs b/DependenciesGui/DependencyExportList.xaml.cs index 912fc96f..52442ebc 100644 --- a/DependenciesGui/DependencyExportList.xaml.cs +++ b/DependenciesGui/DependencyExportList.xaml.cs @@ -63,5 +63,10 @@ private void ExportListCopySelectedValues(object sender, RoutedEventArgs e) } catch { } } + + public void ResetAutoSortProperty() + { + Wpf.Util.GridViewSort.RemoveSort(this.Items, this); + } } } diff --git a/DependenciesGui/DependencyImportList.xaml.cs b/DependenciesGui/DependencyImportList.xaml.cs index 73d3d57f..52df0d89 100644 --- a/DependenciesGui/DependencyImportList.xaml.cs +++ b/DependenciesGui/DependencyImportList.xaml.cs @@ -83,5 +83,10 @@ private void ImportListCopySelectedValues(object sender, RoutedEventArgs e) catch { } } + + public void ResetAutoSortProperty() + { + Wpf.Util.GridViewSort.RemoveSort(this.Items, this); + } } } diff --git a/DependenciesGui/DependencyWindow.xaml.cs b/DependenciesGui/DependencyWindow.xaml.cs index 97925f65..dd0dec3e 100755 --- a/DependenciesGui/DependencyWindow.xaml.cs +++ b/DependenciesGui/DependencyWindow.xaml.cs @@ -1222,9 +1222,11 @@ private void UpdateImportExportLists(DisplayModuleInfo SelectedModule, DisplayMo var machingImports = Parent.Imports.FindAll(imp => imp.Name == SelectedModule._Name); this.ImportList.SetImports(SelectedModule.Filepath, SelectedModule.Exports, machingImports, SymPrv, this); } + this.ImportList.ResetAutoSortProperty(); this.ExportList.SetExports(SelectedModule.Exports, SymPrv); - } + this.ExportList.ResetAutoSortProperty(); + } } public PE LoadImport(string ModuleName, DisplayModuleInfo CurrentModule = null, bool DelayLoad = false) diff --git a/DependenciesGui/GridViewSort.cs b/DependenciesGui/GridViewSort.cs index 30889b20..dbcf3c6c 100644 --- a/DependenciesGui/GridViewSort.cs +++ b/DependenciesGui/GridViewSort.cs @@ -253,6 +253,16 @@ public static void ApplySort(ICollectionView view, string propertyName, ListView } } + public static void RemoveSort(ICollectionView view, ListView listView) + { + view.SortDescriptions.Clear(); + GridViewColumnHeader currentSortedColumnHeader = GetSortedColumnHeader(listView); + if (currentSortedColumnHeader != null) + { + RemoveSortGlyph(currentSortedColumnHeader); + } + } + private static void AddSortGlyph(GridViewColumnHeader columnHeader, ListSortDirection direction, ImageSource sortGlyph) { AdornerLayer adornerLayer = AdornerLayer.GetAdornerLayer(columnHeader);