diff --git a/Flow.Launcher/ViewModel/ResultsViewModel.cs b/Flow.Launcher/ViewModel/ResultsViewModel.cs index 3e464afe1..d62e0d0c3 100644 --- a/Flow.Launcher/ViewModel/ResultsViewModel.cs +++ b/Flow.Launcher/ViewModel/ResultsViewModel.cs @@ -137,8 +137,16 @@ namespace Flow.Launcher.ViewModel { var newResults = NewResults(newRawResults, resultId); - // update UI in one run, so it can avoid UI flickering - Results.Update(newResults); + lock (_collectionLock) + { + // https://social.msdn.microsoft.com/Forums/vstudio/en-US/5ff71969-f183-4744-909d-50f7cd414954/binding-a-tabcontrols-selectedindex-not-working?forum=wpf + // fix selected index flow + if (Results.Count > 0) + SelectedIndex = 0; + + // update UI in one run, so it can avoid UI flickering + Results.Update(newResults); + } if (Visbility != Visibility.Visible && Results.Count > 0) { @@ -159,12 +167,14 @@ namespace Flow.Launcher.ViewModel { var newResults = NewResults(resultsForUpdates); - // https://social.msdn.microsoft.com/Forums/vstudio/en-US/5ff71969-f183-4744-909d-50f7cd414954/binding-a-tabcontrols-selectedindex-not-working?forum=wpf - // fix selected index flow - SelectedIndex = 0; - lock (_collectionLock) { + // https://social.msdn.microsoft.com/Forums/vstudio/en-US/5ff71969-f183-4744-909d-50f7cd414954/binding-a-tabcontrols-selectedindex-not-working?forum=wpf + // fix selected index flow + if (Results.Count > 0) + SelectedIndex = 0; + + Results.Update(newResults); } @@ -172,6 +182,7 @@ namespace Flow.Launcher.ViewModel { case Visibility.Collapsed when Results.Count > 0: Margin = new Thickness { Top = 8 }; + SelectedIndex = 0; Visbility = Visibility.Visible; break; case Visibility.Visible when Results.Count == 0: