mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Don't change selected index unless collection is not empty
This commit is contained in:
parent
e625c192ee
commit
e34a52c74e
1 changed files with 17 additions and 6 deletions
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Reference in a new issue