From 1990226c716227b21797a2ea4113a9f52be9024d Mon Sep 17 00:00:00 2001 From: Vic <10308169+VictoriousRaptor@users.noreply.github.com> Date: Wed, 7 Dec 2022 00:35:41 +0800 Subject: [PATCH] Fix item can't be unselected after editing Location --- .../Views/ProgramSetting.xaml.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Plugins/Flow.Launcher.Plugin.Program/Views/ProgramSetting.xaml.cs b/Plugins/Flow.Launcher.Plugin.Program/Views/ProgramSetting.xaml.cs index 377ef5cf3..086c9ecb3 100644 --- a/Plugins/Flow.Launcher.Plugin.Program/Views/ProgramSetting.xaml.cs +++ b/Plugins/Flow.Launcher.Plugin.Program/Views/ProgramSetting.xaml.cs @@ -174,6 +174,10 @@ namespace Flow.Launcher.Plugin.Program.Views { var vm = new AddProgramSourceViewModel(context, _settings, selectedProgramSource); var add = new AddProgramSource(vm); + int selectedIndex = programSourceView.SelectedIndex; + // https://stackoverflow.com/questions/16789360/wpf-listbox-items-with-changing-hashcode + // Or it can't be unselected after changing Location + programSourceView.UnselectAll(); if (add.ShowDialog() ?? false) { if (selectedProgramSource.Enabled) @@ -188,6 +192,7 @@ namespace Flow.Launcher.Plugin.Program.Views } ReIndexing(); } + programSourceView.SelectedIndex = selectedIndex; } }