Skip to content

Commit

Permalink
improved serach flickering
Browse files Browse the repository at this point in the history
  • Loading branch information
nmetulev committed Nov 16, 2017
1 parent 6e345f1 commit 70c08e6
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions Microsoft.Toolkit.Uwp.SampleApp/Controls/ExtendedHamburgerMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ public void HideSamplePicker()
{
_samplePickerGrid.Visibility = Visibility.Collapsed;
}

var noop = SetHamburgerMenuSelection();
}

public async void ShowSamplePicker(Sample[] samples = null)
Expand Down Expand Up @@ -110,6 +112,14 @@ public async void ShowSamplePicker(Sample[] samples = null)
return;
}

if (_samplePickerGrid.Visibility == Visibility.Visible &&
_samplePickerGridView.ItemsSource is Sample[] currentSamples &&
currentSamples.Count() == samples.Count() &&
currentSamples.Except(samples).Count() == 0)
{
return;
}

_samplePickerGridView.ItemsSource = samples;

if (_currentSample != null && samples.Contains(_currentSample))
Expand Down Expand Up @@ -311,11 +321,6 @@ private void SearchButton_GotFocus(object sender, RoutedEventArgs e)

private void SearchBox_TextChanged(AutoSuggestBox sender, AutoSuggestBoxTextChangedEventArgs args)
{
if (args.Reason != AutoSuggestionBoxTextChangeReason.UserInput)
{
return;
}

UpdateSearchSuggestions();
}

Expand Down Expand Up @@ -367,7 +372,14 @@ private void ExtendedHamburgerMenu_ItemClick(object sender, ItemClickEventArgs e
{
if (_samplePickerGrid.Visibility != Visibility.Collapsed && SelectedItem == e.ClickedItem)
{
HideSamplePicker();
if (_hamburgerButton != null && _hamburgerButton.Visibility == Visibility.Visible)
{
HideItemsInNarrowView();
}
else
{
HideSamplePicker();
}
}
else
{
Expand Down Expand Up @@ -407,7 +419,6 @@ private async Task SetHamburgerMenuSelection()
private void ContentShadow_Tapped(object sender, Windows.UI.Xaml.Input.TappedRoutedEventArgs e)
{
HideSamplePicker();
var noop = SetHamburgerMenuSelection();

if (_hamburgerButton != null && _hamburgerButton.Visibility == Visibility.Visible)
{
Expand Down

0 comments on commit 70c08e6

Please sign in to comment.