From c72e21d660403b9eeb2148dcdf6203c858a8a7a1 Mon Sep 17 00:00:00 2001 From: leo Date: Tue, 14 Jul 2020 10:26:54 +0800 Subject: [PATCH] Use DataGrid instead of ListView to improve performance when there's too many tags --- SourceGit/UI/Dashboard.xaml | 63 ++++++++++++++++++++-------------- SourceGit/UI/Dashboard.xaml.cs | 4 +-- 2 files changed, 40 insertions(+), 27 deletions(-) diff --git a/SourceGit/UI/Dashboard.xaml b/SourceGit/UI/Dashboard.xaml index 48e364bc..6f1ca2de 100644 --- a/SourceGit/UI/Dashboard.xaml +++ b/SourceGit/UI/Dashboard.xaml @@ -369,40 +369,53 @@ - - - - - - - - - + SelectionMode="Single" + SelectionUnit="FullRow"> + + + - - - - - + + + + + + + + + + + + + + + + + + + + diff --git a/SourceGit/UI/Dashboard.xaml.cs b/SourceGit/UI/Dashboard.xaml.cs index 3820e52e..6b0950c2 100644 --- a/SourceGit/UI/Dashboard.xaml.cs +++ b/SourceGit/UI/Dashboard.xaml.cs @@ -838,7 +838,7 @@ namespace SourceGit.UI { } private void TagLostFocus(object sender, RoutedEventArgs e) { - (sender as ListView).UnselectAll(); + (sender as DataGrid).UnselectAll(); } private void TagSelectionChanged(object sender, SelectionChangedEventArgs e) { @@ -849,7 +849,7 @@ namespace SourceGit.UI { } private void TagContextMenuOpening(object sender, ContextMenuEventArgs e) { - var tag = (sender as ListView).SelectedItem as Git.Tag; + var tag = (sender as DataGrid).SelectedItem as Git.Tag; if (tag == null) return; var createBranch = new MenuItem();